jQWidgets Forums
jQuery UI Widgets › Forums › Grid › rendergridrows add params
Tagged: grid, jquery grid
This topic contains 8 replies, has 3 voices, and was last updated by fabbiob 11 years, 6 months ago.
-
Author
-
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.sortdirectionvar 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.
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 StoevjQWidgets Team
http://www.jqwidgets.comcheers 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 rendergridrowsThis 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 .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 StoevjQWidgets Team
http://www.jqwidgets.comThanks 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;
}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’];
}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
fabioHi 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 StoevjQWidgets Team
http://www.jqwidgets.comsorry i made a mistake.
if someone could delete the previous post…thanks
fabio -
AuthorPosts
You must be logged in to reply to this topic.