How in the treecollection to count all items? Not only visible?

treecollection.count() counts only "visible" items...

Tagged:

Comments

  • edited July 10

    Hey @cyrax, you can simply get the length property of your data, after getting it through data.pull and converting it to an array: https://snippet.webix.com/5519q7a3, alternatively you can also iterate through data items via each method and count them manually: https://snippet.webix.com/dy07h0e8

  • I need to sync my dataview to the treecollection. When I do that:
    $$("dataview").sync(treecollection)
    I receive not all items. I have the treecollection as a data source for several receivers. How can I sync and get all items from the treecollection?

  • edited July 12

    This might happen if your TreeCollection parent nodes don't have the open: true property. For instance https://snippet.webix.com/iys6o14s - take a look at the top dataview, it's synced with the first TreeCollection, which only has the root node opened, so it will only show the opened view. The second TreeCollection has all of the nodes opened, so naturally all of the data gets shown in the dataview at the bottom.

    Please note, however, that it is not ideal to try and represent your hierarchical data in a view that works with linear data. As an alternative, you could store your data in a linear way in a DataCollection, and afterwards group it in your hierarchical views (i.e. a tree): https://snippet.webix.com/c449gok9.

  • Thank you a lot!!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion