QTable Multi-Select selects one row, but visually selects all rows
-
Hello, I have a QTable with multi-select and my key is an id. When I select one checkbox I can see that only the corresponding row is selected in the underlying model (this.selected contains only the selected row´s data).
But visually all rows have been selected. It seems that the key is not unique, but you can see in the table data, that it is unique (see the ID table column).Here is a working example: https://codesandbox.io/s/codesandbox-app-ory6f
Can someone explain to me what I am doing wrong?
Thanks,
Tony -
Because nobody replies and that, can I assume that this is a bug?
-
@tonyskulk it isn’t, you see the example in docs works, you probably didn’t set a unique
row-key
. -
@metalsadman Seems like the problem is the nested key I wanted to use. I had to switch the row-key field to an attribute which exists directly on the row without any nested structure (in my case: row._id.$oid, which is the default dealing with json documents coming from mongodb).
Or do you know a way to set up a nested key reference. I tried:row-key="_id.$oid"
but that is not working.
-
@tonyskulk since it’s an object you’ll need to supply a function for
row-key
prop, ie.:row-key="row => row._id.$oid"
. check the description in the api cards. -
@metalsadman per the docs, when I do this :row-key=“row => row.ID” I get this error:
Invalid prop: type check failed for prop “rowKey”. Expected String with value “function(row) { return row.ID }”, got Function
Also the docs says " If supplying a function then for best performance, reference it from your scope and do not define it inline", but I haven’t been able to get that working either. Do you have any ideas?
-
@bdaviddee check if you are using latest quasar version.
-
@metalsadman Yup you’re right, needed an update, Thank you!