datatable onAfterLoad when data is a DataCollection

Hi

I found that when creating a datatable, you can set the data:-property to an instance of webix.DataCollection. This is not mentioned in the api-docs, but I hope this is intended behavior, and will continue to work.

But, if I use a DataCollection as the data, the onAfterLoad-event on the datatable will not fire. The onAfterLoad on the DataCollection will fire.
But I would like to do something to my datatable when data has been loaded. A thing that I will not want to attach to the dataCollection.

How can I do that?

-mads

Hi,

you can try to set onStoreUpdated of DataTable’s data. Such an event handler can be set via “on” property of DataTable. But you need to apply “data->” prefix to the event name:

http://webix.com/snippet/cb396fd5

Thanks, I will try that.

I’ve seen this ‘data->’ prefix in other examples, but I do not know what it really does? I cannot find it mentioned in the documentation.

-mads

onStoreUpdated is fired on the DataStore of DataTable. “data->onStoreUpdated” usage is described in the following example:

http://docs.webix.com/datatable__index_columns.html#dynamicindexcolumns

Thanks.
This line explains it to me:

“data->onStoreUpdated” is equal to $$(‘mytable’).data.attachEvent(‘onStoreUpdated’, function(){…})

I’ve run exactly into the same problem. And I’ve read through ALL the 100 or so Datatable events, and didn’t see any “data->” events documented.

Webix team, please, try to offer complete documentation. A reference page like the Datatable events one should list all events. Developers should not have to magically know they need to look at some “Dynamic index columns” section in order to find an undocumented Datatable event. :-1:

If I understand correctly, events of the underlying data store are accessible via the data-> prefix. This should be clearly mentioned at the top or the bottom of the page – if that’s actually the case. I’ve found that onParse does not fire when the table’s data is a DataCollection.

Also, what does the “itemId” parameter from your sample do? It’s not listed in that Dynamic index columns example.

Also, what does “this” point to?

Also, how many times does onStoreUpdated trigger? (I see it triggering three times for one single load in my code, using a GraphQL proxy URL).

Hey @dandv,

If I understand correctly, events of the underlying data store are accessible via the data-> prefix.

This is exactly how it is. Writing data->someEvent is basically the same as writing $$("datatable").data.attachEvent(...) (as can be seen from the post above). The onParse event doesn’t fire in this case because of the DataCollection, since it is populating the DataStore’s pull directly via sync, without calling the methods that would trigger an onParse event.

The itemId from this sample is pointing to the id of the item that was updated in the store, as seen from the documentation. “This” will point to the datatable view in this case.