Footer for dynamic loading

Hello,
How can I use the footer summColumn functionality with dynamic data loading and data filtering.

https://webix.com/snippet/2874bd69

Thanks in advance.

Comments

  • I can confirm the issue, thank you for reporting.

    As a temporary solution, you can add a custom calculation to the footer instead of the default: https://webix.com/snippet/854664ee (iterates only through the loaded data)

  • edited October 11

    Thanks, Listopad
    Is there any way to set counts from response (like total_count - master.data.count()).
    Use case: user aplies some filter and as result the summ counter will be updated by new TOTAL value from response..(not through iterates)

  • DataFilter object works with any data available on the client-side and will render any valid string/HTML
    Basically, you can get the total number of records and the sum of the loaded data.

    The full total can be provided from the server response as an additional parameter. Check the onParse event in the grid configuration:

    https://webix.com/snippet/8d4794cb

  • Many thanks Listopad.

    It's good solution.

  • Hi,
    Try to use this solution for treetable, but it does not work.
    Uncaught TypeError: Cannot read property 'id' of undefined
    at webix.DataStore. (webix.js:7)
    at webix.DataStore.eachChild (webix.js:7)
    at webix.DataStore.eachOpen (webix.js:7)
    at webix.DataStore.count (webix.js:7)
    at o.count (webix.js:7)
    at Object.refresh (8d4794cb:26)
    at o.fk (webix.js:7)
    at o.refreshHeaderContent (webix.js:7)
    at o.nz (webix.js:7)
    at webix.DataStore. (webix.js:7)
    Do I something wrong.
    https://webix.com/snippet/cec7de5d

  • count() method has different implementation for hierarchical data components and fails as footer initially rendered before the data loading.
    We will investigate the aptitude of this behaviour, but please replace the master.count() with master.data.order.length:

    webix.ui.datafilter.totalCounted = webix.extend({
      refresh:function(master, node, value){
        var result = 0;
        master.data.each(function(obj){
          var column = value.columnId;
          if (obj && obj[column]){
            result ++;
          }
        });   
        node.firstChild.innerHTML = result+" items of "+master.data.order.length
      }
    }, webix.ui.datafilter.summColumn);
    
  • Yep, such .count() error is a bug. We will fix it in the nearest update, so in future you will be able to safely use it.

  • Many thanks!

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!