Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





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

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
How to integrate jqGrid with CakePHP
12/10/2008
20:27
Avatar
myles
myles
Member
Members
Forum Posts: 7
Member Since:
13/10/2008
sp_UserOfflineSmall 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
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall 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 Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

13/10/2008
02:54
Avatar
myles
myles
Member
Members
Forum Posts: 7
Member Since:
13/10/2008
sp_UserOfflineSmall 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
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall 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 Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

13/10/2008
20:59
Avatar
myles
myles
Member
Members
Forum Posts: 7
Member Since:
13/10/2008
sp_UserOfflineSmall Offline

To simplyfy my question,

How can I use jqGrid with CakePHP?

Thanks and Regards,

Myles

14/10/2008
03:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall 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 Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/10/2008
20:50
Avatar
myles
myles
Member
Members
Forum Posts: 7
Member Since:
13/10/2008
sp_UserOfflineSmall 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
Avatar
myles
myles
Member
Members
Forum Posts: 7
Member Since:
13/10/2008
sp_UserOfflineSmall 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
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall 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 Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

14/11/2008
23:18
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

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
Avatar
myles
myles
Member
Members
Forum Posts: 7
Member Since:
13/10/2008
sp_UserOfflineSmall Offline

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

Thanks in advance

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

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
Avatar
xuding
xuding
Member
Members
Forum Posts: 36
Member Since:
15/11/2008
sp_UserOfflineSmall Offline

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

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

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

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

27/11/2014
02:34
Avatar
sebastiancb
COlombia
Member
Members
Forum Posts: 23
Member Since:
05/09/2011
sp_UserOfflineSmall 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: 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.com

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information