Use another property in the data item as id

I have data elements:

{ 'rid': '1', 'id': '2', 'name': 'asdw' }, { 'rid': '2', 'id': '2', 'name': 'dsddf' }, { 'rid': '3', 'id': '2', 'name': 'fffgg' } 

Each data item has the same value for the "id" property (slickgrid throws me). Each data item must implement a unique property called "id"). How can I use another property in the data element as id (for example, "rid")? I cannot remove the props from the data object.

+6
source share
1 answer

You can try to customize your objects using the setItems (data, objectIdProperty) method defined in the DataView in the slick.model.js file.

 function setItems(data, objectIdProperty) { if (objectIdProperty !== undefined) idProperty = objectIdProperty; items = data; refreshIdxById(); refresh(); } 
+9
source

Source: https://habr.com/ru/post/888304/


All Articles