How to sum render data
How to sum render data
qqww
Posts: 3Questions: 1Answers: 0
i need to sum data from render: "[].ves" now its look like 90,60 i need in this case 150. Sorry for english.
my code:
->join(
Mjoin::inst( 'chast' )
->link( 'razdelka.id', 'chast.razdelka' )
->fields(
Field::inst( 'ves' )
)
)
client:
columns: [
{ data: "chast", render: "[].ves" }
]
Help me! i weaste all day.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to use
columns.render
as a function - for example:Allan
Thanks for reply!
i try to use you example, and they return me 09060 (before i put 90 and 60), not sum
That suggests that
ves
is a string. You'd need to cast it as a number. You can do that simply by using:d[i].ves*1
.Allan
thanks Allan!