How to iterate/count cards in list

Hi,

I’d like to iterate over my kanban board and check the number of cards in each list, I got as far as listing each kanbanlist but cannot find more api info on that, please help?

                 $$("mykanban").eachList(function(list,status){
                    if (list) {
                        //need a count of the cards in the list
                        //also, how to iterate the cards in this list
                    } 
                 });

Hello,

KanbanList inherits from UI List and uses all its API. So, you can

  • use the count() method to count the cards;
  • use the each() iterator of List’s Datastore to get the information about all cards as list.data.each(logic).

Please, check the following snippet: https://webix.com/snippet/bdfff8cc

If I do that my list.count() is always zero. I think it is because I use a url to load my data and the cards are not populated when the script runs?
What would be the best event to use for your code above when using url loading?

You can use the ready handler to catch the moment when the data is loaded and Kanban board is fully rendered:

view:"kanban",
ready:function(){ ... }

https://webix.com/snippet/2830e655

Sorted, thanks Helga