how to show summary of row in colomn render

how to show summary of row in colomn render

kharismaticskharismatics Posts: 6Questions: 2Answers: 0
edited March 2019 in Free community support

i have data like this ...

and have problem to show data like this..

the summary of a column use the footerCallback and get 100, and what i imagine to show the remark is something like

{
data: null,
render: function (val, type, row) {
return val + ' / ' + total;
}
}

(total it's just my opinion of variable :smiley: )

my problem is how to show remark column like that ? i cant get the total

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,158Questions: 1Answers: 2,587
    Answer ✓

    Hi @kharismatics ,

    That was a fun puzzle! The problem, as you could tell, is that the footerCallback is called late in the process, so it wouldn't be available when the cell data is created.

    To workaround this, you need to do two draws - one to generate the footer, and a second to fill in the cells - see example here. This may be inefficient if you've got a large amount of data on each page (many, many rows), and in that case you'll probably need to scan the table yourself to get the total (rather than rely on the DataTables framework), but for small amounts of data, this should be fine.

    Hope that does the trick,

    Cheers,

    Colin

  • kharismaticskharismatics Posts: 6Questions: 2Answers: 0

    Hi @colin

    in that fun puzzle case i use a little sql query trick actually, but i'm sure that there is a front-end trick.

    your explaination was great and open my mind :blush: ..
    but i can't open the link you shared (404 Not Found),
    just need little bit example

  • kharismaticskharismatics Posts: 6Questions: 2Answers: 0

    Hi @colin

    in that fun puzzle case i use a little sql query trick actually, but i'm sure that there is a front-end trick.

    your explaination was great and open my mind :blush: ..
    but i can't open the link you shared (404 Not Found),
    just need little bit example

  • colincolin Posts: 15,158Questions: 1Answers: 2,587
    Answer ✓

    Odd, the link works for me. Here it is again : http://live.datatables.net/pikebivi/1/edit

This discussion has been closed.