Forum

November 2nd, 2014
A A A

Please consider registering
guest

Log In

Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Minimum search word length is 4 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
Topic RSS
How to integrate jqGrid with CakePHP
12/10/2008
20:27
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline

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

13/10/2008
01:36
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7721
Member Since:
30/10/2007
Offline

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 PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site - trirand.net - by the very same guys that created jqGrid.
13/10/2008
02:54
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline

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

13/10/2008
04:01
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7721
Member Since:
30/10/2007
Offline

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 PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site - trirand.net - by the very same guys that created jqGrid.
13/10/2008
20:59
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline

To simplyfy my question,

How can I use jqGrid with CakePHP?

Thanks and Regards,

Myles

14/10/2008
03:47
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7721
Member Since:
30/10/2007
Offline

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 PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site - trirand.net - by the very same guys that created jqGrid.
20/10/2008
20:50
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline

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'];

20/10/2008
21:07
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline

I mean can I use jqGrid like the code snippet below:

datatype : function(pdata){

$.ajax({

url: 'getJsOnData(page, rows, sidx, sord)',

data: pdata,

21/10/2008
01:18
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7721
Member Since:
30/10/2007
Offline

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 PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site - trirand.net - by the very same guys that created jqGrid.
14/11/2008
23:18
xuding
xuding
Member
Forum Posts: 36
Member Since:
15/11/2008
Offline
10

Dude, I have just done the integration after half day trying..

Let me know if you still need help with it since thi is a old post.

12/12/2008
01:54
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline
11

Yes if you have can have a sample in your implementation please post here.

Thanks in advance

22/01/2009
19:58
xuding
xuding
Member
Forum Posts: 36
Member Since:
15/11/2008
Offline
12

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..

16/04/2009
23:47
xuding
xuding
Member
Forum Posts: 36
Member Since:
15/11/2008
Offline
13

I have wrote a simply tutorial of integration on my blog:

http://www.the-di-lab.com/?p=1

15/05/2009
03:45
myles
myles
Member
Forum Posts: 7
Member Since:
13/10/2008
Offline
14

Thanks for the effort in making a tutorial and also a sample I try it

27/11/2014
02:34
sebastiancb
COlombia
Member
Forum Posts: 23
Member Since:
05/09/2011
Offline

I have wrote another simply tutorial of integration using xml on my blog: http://desarrollandosw.wordpre.....-y-jquery/

Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
34 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.com, swathi

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information