Forum
20:27
13/10/2008
Good Day to All!
First I would like to thank the creators of jqGrid for an awesome grid and documentation.
My question is can we use a function instead of using a php file url to
have pagination?
I mean instead of using the code snippet below:
jQuery("#MyList").jqGrid
({
url:'server.php?q=2',
datatype: "json",
can we do something like this?
jQuery("#MyList").jqGrid
({
url:'GenerateJson()',
datatype: "json",
Hope someone could help.
Thanks and Regards,
Myles
01:36
Moderators
30/10/2007
Hello,
The final release have something like
datatype : function(pdata){
// call your own function here
// use addXmlData or addJSONData methods
}
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
02:54
13/10/2008
What did you mean final release? you mean version 3.3?
Can you please explain more on your sample I am a little bit confused.
All I want to do is use jqGrid in CakePHP but the problems is in CakePHP
you have to access data through a Controller or Controller Components.
And in the samples it gets data through a PHP page.
Can anybody enlighten me on this.
Thanks and Regards,
Myles
04:01
Moderators
30/10/2007
Hello,
It is a little confused for me, but the current published version
3.3. is preview release. Final will be in Tuesday.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
03:47
Moderators
30/10/2007
Hello,
Since I do not know CakePHP - but if you can call direct via url a function
as of your code it is a really simple: (suppose JSON)
datatype : function(pdata){
$.ajax({
url: 'yourfunctionhere',
data: pdata,
complete : function(response,status) {
if(status=='success'){
var mygrid = jQuery(gridid)[0];
mygrid.addJSONData(eval(”(”+response.responseText+”)”));
}
}
…
})
}
Hope this helps
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
20:50
13/10/2008
Thank very much for the response.
By the way with the code above how can I implement pagination and
filtering of data?
Can jqGrid pass values through the function parameters to get data for
pagination and filtering data instead of passing through the URL?
Like this variables in the sample:
// to the url parameter are added 4 parameter
// we should get these parameter to construct the needed query
// for the pager
// get the requested page
$page = $_REQUEST['page'];
// get how many rows we want to have into the grid
// rowNum parameter in the grid
$limit = $_REQUEST['rows'];
// get index row - i.e. user click to sort
// at first time sortname parameter - after that the index from colModel
$sidx = $_REQUEST['sidx'];
// sorting order - at first time sortorder
$sord = $_REQUEST['sord'];
01:18
Moderators
30/10/2007
Hello,
That is you solution except that pdata contain all the needed pagging parameters - i.e. pdata is actually postData array.
If you can not use pdata you can do it in you function this way
datatype : function(pdata){
...
$.ajax({
url: 'getJsOnData(pdata.page, pdata.rows, pdata.sidx, pdata.sord)',
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Since Cakephp follows MVC, model. and jqgrid is getting data from
jQuery(”#MyList”).jqGrid
({
-> url:'server.php?q=2'
....
so we can actually put a html helper here in 'url' .
$html->link('/myapp/tabledata').
and in myapp controller, we create a action tabledata to pull out table data , and in tabledata view, we form the xml or json data, and the basic integration is done.
similar to this ,we could do adding,editting, deleting and so on in our controller.
p/s: i am using cakephp 3.3 .
Hope you can get what I mean, i will try to write a detailed tutorial if needed when I have time.
Enjoy cake and grid..
02:34
05/09/2011
I have wrote another simply tutorial of integration using xml on my blog:Â http://desarrollandosw.wordpre.....-y-jquery/
Most Users Ever Online: 715
Currently Online:
70 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66