rowGroup endRender multiple Rows

rowGroup endRender multiple Rows

BhavinBhattBhavinBhatt Posts: 18Questions: 6Answers: 0

is there any way to put multiple rows in endRender function for rowGroup?

below code returns only singlr TR element. I need to put results in multiple rows, say.. 3 rows in this instance.

                                                  return $('<tr/>')
                                                        .append('<td colspan="5" align="center" >' + group + '-TOTAL: ' + '</td>')
                                                        .append('<td align="right">' + tQty + '<br>' + 'Bal. Qty:' + '</td>')
                                                        .append('<td align="right">' + tDispQty +'<br>' + tBalQty + '</td>')
                                                        //.append('<br>' + tBalQty)
                                                        //.append('<td/>')//
                                                        //.append('<td></td>')
                                                }
                                                , dataSrc: [2]

Replies

  • colincolin Posts: 12,602Questions: 0Answers: 2,154

    You can add a <br> to do that, see here: http://live.datatables.net/samumepo/1/edit

    Colin

  • BhavinBhattBhavinBhatt Posts: 18Questions: 6Answers: 0

    Thanks Colin,
    I've already used this .

  • colincolin Posts: 12,602Questions: 0Answers: 2,154

    Ah sorry, so you did. But yep, that's the only easy option I'm afraid. You may be able to add additional lines within draw but I suspect that would get messy. I did originally think drawCallback, but that's triggered before the RowGroup groups are constructed, draw is called last.

    Colin

  • BhavinBhattBhavinBhatt Posts: 18Questions: 6Answers: 0

    Collin,Thanks for the answer, I've already apply this in my earlier reports.
    My another concern is when row group ends in endRender function, I wanna add multiple <td> elements which is to be find from another array.. say the same data set with existing parameters.

    How to find values from 2d array and append in group summary.. ?

    Br,
    Bhavin.

  • colincolin Posts: 12,602Questions: 0Answers: 2,154

    Sorry, I'm not following that. Could you create a test case that demonstrates what you're after, please. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • BhavinBhattBhavinBhatt Posts: 18Questions: 6Answers: 0

    Collin,
    Ive created ajax call to populate master data.
    secondly, anotehr call prepares sub report based on a group of master.. and populate results in 2d array.

    datatable assigns after ajax calls so no calls made withing endRender except a local js function which finds value based on current group.

  • colincolin Posts: 12,602Questions: 0Answers: 2,154

    As I said, we'll need to see this - to progress this, as requested, please can you update my test case or link to your page so we can get a clear understanding of what you're trying to do,

    Colin

  • BhavinBhattBhavinBhatt Posts: 18Questions: 6Answers: 0
    var customMessage = ''; var fromDt; var toDt; matConsData=[];

    <

    script type="text/javascript">
    $.ajax
    (
    {
    type: "POST",
    url: url + "/GetRYSumm", //respective WebService from asmx file...
    //data: "{'MonthN':'02', 'YearN':'2019'}",
    //data:$.toJSON(params),
    data: JSON.stringify(params),
    contentType: "application/json;; charset=utf-8",
    dataType: "json",
    cache: false,
    success: OnSuccessCall,
    error: OnErrorCall
    }
    );
    $.ajax
    (
    {
    type: "POST",
    url: url + "/GetRYSummSub", //respective WebService from asmx file...
    //data: "{'MonthN':'02', 'YearN':'2019'}",
    //data:$.toJSON(params),
    data: JSON.stringify(params),
    contentType: "application/json;; charset=utf-8",
    dataType: "json",
    cache: false,
    success: OnSuccessSubCall,
    error: OnErrorSubCall
    }
    );

    function OnSuccessSubCall(response)
    {
    //some logic to create array from response.
    //global array to be populate.
    matConsData = response.d.map
    (
    function (e)
    {
    return [e.GroupName, e.Drawing, e.Yld, e.Apr, e.May, e.Jun, e.Jul,
    e.Aug, e.Sep, e.Oct, e.Nov, e.Dec, e.Jan, e.Feb, e.Mar, e.TotYld,
    e.Total];
    }
    );
    }

    $('#tblData').DataTable
    (
    startRender:null,
    endRender:function(rows,group)
    {
    //logic to create summarized data.. say totals of each columns..
    //put an end row which is to be searched from matConsData based on
    group
    //here needs help.. how to fetch data from global variable. ??
    }
    ,dataSrc:[0]
    );

    </script?

Sign In or Register to comment.