jQWidgets Forums

jQuery UI Widgets Forums Grid rendergridrows add params

Tagged: ,

This topic contains 8 replies, has 3 voices, and was last updated by  fabbiob 11 years, 6 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • rendergridrows add params #4677

    ScottNL
    Member

    Hallo again, still busy with rendergridrows.

    is it possible to add params to rendergridrows

    reason why:

    $(“#jqxgrid”).bind(“sort”, function (event) {
    var sortinformation = event.args.sortinformation;
    var sortdirection = sortinformation.sortdirection.ascending ? “ascending” : “descending”;
    var sortcolumn = sortinformation.sortcolumn;
    add these to rendergridrows params
    sortcolumn
    sortdirection

    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’);

    });

    then here

    var rendergridrows = function (params) {

    i want to be able to all these new setting so i can include them in my json request
    params.sortcolumn
    params.sortdirection

    var griddata = getjqdata(params.startindex, params.endindex );
    return griddata[‘data’];

    }

    I am a java/jquery newbe and i might be going on about this the wrong way. But i need to pass more information to my php scripts and back than the built in jqwidget has.

    Thanks in advance.

    rendergridrows add params #4679

    Peter Stoev
    Keymaster

    Hi ScrottNL,

    The rendergridrows is a called by the jqxGrid and the Grid passes the start and end row indexes. The function should return an array of records. You can take a look at the Virtual Scrolling and Virtual Data samples that demonstrate how to use that function. You cannot add additional parameters. However, you may call another function inside the body of that function. In addition, the Grid sends some parameters to the server when it makes requests. Take a look at the help topics about the PHP, ASP .NET MVC or ASP .NET Integration and also see this help topic: jquery-grid-extra-http-variables.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    rendergridrows add params #4682

    ScottNL
    Member

    cheers peter.

    I got the function to work before but it was 1 step behind the current action

    var rendergridrows = function (params) {

    var sortinformation = $(‘#grid’).jqxGrid(‘getsortinformation’);
    var sortcolumn = sortinformation.sortcolumn;
    var sortdirection = sortinformation.sortdirection;

    var griddata = getjqdata(params.startindex, params.endindex,sortcolumn,sortdirection );
    return griddata[‘data’];

    }

    getsortinformation
    show’s me the current position. I could not get a event handler to work within rendergridrows

    This is the last piece of the puzzle i need to figure out to complete the program.

    if you could help me out i would be very great full.

    => jquery-grid-extra-http-variables.htm.
    i couldn’t use this because there’s much more going on in the page and all info is linked to the json. That’s why i had to use my own call function to the data .

    rendergridrows add params #4684

    Peter Stoev
    Keymaster

    Hi ScottNL,

    Actually, the help topic shows the params that the Grid sends to the server, but it also illustrates how you can add additional parameters and send them to the server. An additional help topic which illustrates that functionality is that one: jquery-grid-jsonp-data-source.htm.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    rendergridrows add params #4685

    ScottNL
    Member

    Thanks peter for your prompt response

    I was aware of this feature but cannot use it because i am returning more data than just grid data.

    i need full control of the response

    the response configures these jqwidgets params:

    $(“#jqxgrid”).jqxGrid(settings);
    $(“#jqxgrid”).jqxGrid({rendergridrows: rendergridrows});
    $(“#jqxgrid”).jqxGrid(‘source’, source );
    $(“#jqxgrid”).jqxGrid(‘columns’, columns);

    and about 10 other things in the page. That was why i couldn’t do it this way.

    i use this method:

    function getjq(url,getparams){
    var result;
    $.ajax({
    type: “GET”,
    url: url,
    data: getparams,
    dataType: “json”,
    async: false,
    success: function(data) {
    result = data;
    }
    });
    return result;
    }

    rendergridrows add params #4730

    ScottNL
    Member

    In the end it was a easy fix

    add this:

    $(“#jqxgrid”).bind(“sort”, function (event) {
    var sortinformation = event.args.sortinformation;
    sortinformation.sortcolumn = sortinformation.sortcolumn;
    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’);
    });

    to set the sortinformation to the current sort column

    then in rendergridrows you can call sortinformation with current selected column name

    var rendergridrows = function (params) {

    var sortinformation = $(“#jqxgrid”).jqxGrid(“getsortinformation”);
    var sortcolumn = sortinformation.sortcolumn;
    var sortdirection = sortinformation.sortdirection;
    if(typeof sortdirection!=’undefined’ && typeof sortcolumn!=’undefined’){
    sortdirection = sortinformation.sortdirection.ascending ? “ascending” : “descending”;
    sortcolumn = sortinformation.sortcolumn;
    }else{
    sortdirection = false;
    sortcolumn = false;
    }
    var griddata = getjqdata(“ajax/table.php”,params.startindex, params.endindex,getsearchparams(),sortcolumn,sortdirection );

    return griddata[‘data’];
    }

    rendergridrows add params #46407

    fabbiob
    Participant

    thanks peter for your fast answer
    Is there any way to manage the event just on some cell?
    due to the fact that event is fired on every cell in the grid,
    does the workaround work also for cellclick?

    thanks again
    fabio

    rendergridrows add params #46410

    Peter Stoev
    Keymaster

    Hi fabio,

    I do not think that your question is related to this Topic. I think that your question is about “cellsrenderer” and in that case I suggest you to look at the help topic about “cellsrenderer” in the documentation.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    rendergridrows add params #46412

    fabbiob
    Participant

    sorry i made a mistake.
    if someone could delete the previous post…

    thanks
    fabio

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.