Math on Bind, Summ Footer

Hello everyone…
I made a snippet here and have couple question on the following
http://webix.com/snippet/e3f41dcd

  1. the math function on bind-ed table is not working. How to fix it? Do I have to run command on every select? what command?
  2. how to do sum footer? I copied it from the docs but it doesn’t effect anything. How to fix it?
  3. How to grab the binded value to coloumn? in this case the sum of the table from question 2 to price column on treetable.

I need it really to do my college project, please help.
Thank you very much…

Hello guys…

I updated the snippet

Here’s the link http://webix.com/snippet/cd5ef9a8

My questions are…

  1. the math function on bind-ed table is not working. How to fix it? Do I have to run command on every select? what command?

  2. how to do sum footer? I copied it from the docs but it doesn’t effect anything. How to fix it?

  3. How to grab the binded value to coloumn? in this case the sum of the table from question 2 to price column on treetable.

Hey team…

I finally solve the first question

here’s the snippet http://webix.com/snippet/9bf2e2b5

the key is to refresh columns of the datatable

Well the second question is answered…

I forgot to add footer:true on the table

here’s the updated snippet http://webix.com/snippet/b55b219e

Hello,

  1. We will include the fix for this issue in one of the next updates. Your solution is great.

  2. There is no such a built-in method. Probably it would be better calculate some values before they are loaded into a datatable.

Hello too, Maria

Thanks for the feedback. I’m making a little function to calculate it manually. I test it on the console, it works perfectly. But in the column, it wont show up. If I test by printing to the console, it indicates that the function didn’t called. Do I miss something?

Here’s the updated snippet http://webix.com/snippet/4a305ea5

Hello,

You can use “template” property of the column. However, math is not applied to the template result:

http://webix.com/snippet/83f9183f

therefore, you need to use “template” for the total_price too:

http://webix.com/snippet/df4ae367

Wow, that was a great help!

Thank you very much for the fix!!

Hey again Maria…

Sorry to bother you again, I successfully do child_tree sum calculation.

Here the snippet http://webix.com/snippet/eaffebc7

It solve the problem, but I failed on checking whether the item has child or not. Do webix have some function to check it?

You can use isBranch method to check whether an item has sub-items:

var isBranch = $$("table").isBranch(id);

Once again, thank you…

Here is the updated snippet http://webix.com/snippet/c70e9123

Hello again Maria,

I want to add some number formatting, but in the treetable it always return NaN.undefined. So, I made some ‘loop detector’ to detect the last recursive so that the last will return formatted number. Do you have better method to do this?

here’s the snippet to what I did http://webix.com/snippet/9cfabb21

And there is some bug. First, the format show up just when I click the treetable. Second, the changes on the datatable not directly change the treetable too.

I fix the bug… http://webix.com/snippet/3c5d6a1c

so back to the question, do you have better method to do this?

thank you…

1 Like