jQWidgets Forums

jQuery UI Widgets Forums Grid Expanding Nested grid 2nd time database call is not happening

This topic contains 7 replies, has 2 voices, and was last updated by  RajaniKantaPanda 12 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • Hi, When Expanding Nested grid 2nd time database call(ajax call to controller) is not happening. If any example please let me know.


    Peter Stoev
    Keymaster

    Hi RajaniKantaPanda,

    The “initrowdetails” function is called when the row’s details needs to be initialized. If the details are already initialized, the function will not be called again. Save the nested Grid’s instance in a local variable and if you want to update it, use the ‘updatebounddata’ method.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    If you have any sample code please share.

    Once i m expanding the nested grid button its hiting debugger; but when doing 2nd time(after collapse),its not hitting debugger.
    Need help…

    var nestedgridrecords=function (index, parentElement, gridElement, record) {
    debugger;
    var parentsLength = $(“#jqxgridExistingPlatform”).parents().length;
    var jqxgridnestedgridurl = ‘../PlatformAdmin/GetExistingPltfrmsRegionalData’;
    var grid = $($(parentElement).children()[0]);
    grid.bind(‘bindingcomplete’, function (event) {
    if (event.target.id == “grid” + index) {
    grid.jqxGrid(‘beginupdate’);
    var datainformation = grid.jqxGrid(‘getdatainformation’);
    for (var i = 0; i < datainformation.rowscount; i++) {
    var hidden = true;
    grid.jqxGrid('setrowdetails', i, "

    “, 220, hidden);
    }
    grid.jqxGrid(‘endupdate’);
    }
    });
    //grid.jqxGrid(‘updatebounddata’);//not happening
    grid.jqxGrid(‘updatebounddata’);

    $.ajax({
    url: jqxgridnestedgridurl, cache: false,
    data: { PlatformModelID: PlatformModelID },
    success: function (data, status, xhr) {
    var jqxGridForNestedGrid = {};
    jqxGridForNestedGrid = data;
    var recordnstd = $(“#jqxgridExistingPlatform”).jqxGrid(‘getrowdata’, index);

    var gridnst = $($.find(‘#grid’ + index));
    var datasbyid = $(jqxGridForNestedGrid).find(‘PHNo:’ + phid);
    var datasbyidarr = new Array();
    for (i = 0; i < datasbyid.length; i++) {
    datasbyidarr[i] = $(datasbyid[i]).parent()[i];
    }

    var ssource = {
    datafields: [{ name: 'PlatformDateID' },….],
    datatype: "array",
    localdata: jqxGridForNestedGrid
    }

    ssource = new $.jqx.dataAdapter(ssource);

    if (grid != null) {
    grid.jqxGrid({
    source: ssource, theme: theme, width: '96%', autoheight: true, editable: false, altrows: true, enabletooltips: true,
    columns: [

    { text: '', datafield: 'PlatformDateID', width: '0%', hidden: true },
    ………..
    ]
    });
    }

    }
    });
    }
    nestedgridrecords.jqxGrid('updatebounddata');//not happening(ERROR)
    $(“#jqxgridExistingPlatform”).jqxGrid(
    {
    width: ‘100%’,
    //autowidth: true,
    height: 310,
    //autoheight: true,
    source: dataAdapterExistingPlatform,
    editable: true,
    pageable: true,
    altrows: true,
    enabletooltips: true,
    theme: theme,
    enablehover: false,
    selectionmode: ‘multiplerows’,
    filterable: true,
    sortable: true,
    editmode: ‘multiplecellsextended’,
    rowdetails: true,
    rowdetailstemplate: { rowdetails: “

    “, rowdetailsheight: 130, rowdetailshidden: true, width: “100%” },
    initrowdetails: nestedgridrecords,
    autoshowfiltericon: true,

    How will it hit the debugger 2nd time. In grid calling like this

    initrowdetails: nestedgridrecords,

    Need your help peter.

    How will it hit the debugger 2nd time. In grid,I am calling like this

    initrowdetails: nestedgridrecords,

    Need your help peter.


    Peter Stoev
    Keymaster

    Hi RajaniKantaPanda,

    As I posted the last time, the “initrowdetails” function is called when the row’s details needs to be initialized. If the details are already initialized, the function will not be called again. That is by design. Save the nested Grid’s instance in a local variable or array with key/value pairs outside the “initrowdetails” and if you want to update a Grid, get its instance from the local variable and use the Grid Control’s ‘updatebounddata’ method.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Hey Peter, U have given one sample in this below url
    http://www.jqwidgets.com/community/topic/initrowdetails-is-not-firing-in-single-click/
    Would you modify these piece of code with your solution.

    or

    Can you please look into my code.I am using rowexpand to call initrowdetails. still not calling the child grid(nestedgridrecords variable) during 2nd click.

    var nestedgridrecords=function (index, parentElement, gridElement, record) {
    debugger;

    $(“#InfoMessages”).html(”);
    var parentsLength = $(“#jqxgridExistingPlatform”).parents().length;
    var jqxgridnestedgridurl = ‘../PlatformAdmin/GetExistingPltfrmsRegionalData’;

    var grid = $($(parentElement).children()[0]);
    //grid .jqxGrid(‘updatebounddata’);
    $.ajax({
    url: jqxgridnestedgridurl, cache: false,
    data: { PlatformModelID: PlatformModelID },
    success: function (data, status, xhr) {
    var jqxGridForNestedGrid = {};
    jqxGridForNestedGrid = data;
    var recordnstd = $(“#jqxgridExistingPlatform”).jqxGrid(‘getrowdata’, index);
    var phid = recordnstd.PHNo;
    var gridnst = $($.find(‘#grid’ + index));
    var datasbyid = $(jqxGridForNestedGrid).find(‘PHNo:’ + phid);
    var datasbyidarr = new Array();
    for (i = 0; i < datasbyid.length; i++) {
    datasbyidarr[i] = $(datasbyid[i]).parent()[i];
    }

    jqxGridForNestedGrid = DateSet(data);

    var ssource = {
    datafields: [{ name: 'PlatformDateID' }, {}],
    datatype: "array",
    localdata: jqxGridForNestedGrid
    }
    ssource = new $.jqx.dataAdapter (ssource);

    if (grid != null) {
    grid.jqxGrid({
    source: ssource,
    theme: theme, width: '96%', autoheight: true, editable: false, altrows: true, enabletooltips: true,
    columns: [

    ]
    });
    }

    }
    });
    }
    $('#jqxgridExistingPlatform').bind('rowexpand', function (event) {
    debugger;

    /* Upto here it is coming but nestedgridrecords(debugger) not going when clicking for 2nd time. */

    $('#jqxgridExistingPlatform').jqxGrid({ initrowdetails: nestedgridrecords });
    //$("#jqxgridExistingPlatform").jqxGrid('updatebounddata');
    });

    $("#jqxgridExistingPlatform").jqxGrid(
    {
    width: '100%',
    //autowidth: true,
    height: 310,
    //autoheight: true,
    source: dataAdapterExistingPlatform,
    editable: true,
    pageable: true,
    altrows: true,
    enabletooltips: true,
    theme: theme,
    enablehover: false,
    selectionmode: 'multiplerows',
    filterable: true,
    sortable: true,
    editmode: 'multiplecellsextended',
    rowdetails: true,
    rowdetailstemplate: { rowdetails: "

    “, rowdetailsheight: 130, rowdetailshidden: true, width: “100%” },
    //initrowdetails: nestedgridrecords,
    autoshowfiltericon: true,
    columns: [
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.