Home > CakePHP+JQuery > Integration of Cakephp and JqGrid (2)

Integration of Cakephp and JqGrid (2)

As requested, I have made a working copy of cakephp+jqgrid integration.

Note: This copy is built on cakephp 1.2

And you can get it from HERE.

Please read “readMe.txt” inside the folder, because there is a few configurations you need to set up  before you can run it.

After you set up the demo, you should be able to see a grid table similar to this:

demo

If you encounter any problems, please let me know , I will be very happy to help out.

And happy cake ~~!!

admin CakePHP+JQuery , , ,

  1. Peter
    May 9th, 2009 at 00:39 | #1

    Oh great, thank you very much.
    I think this will greatly aid many people.

  2. May 12th, 2009 at 04:26 | #2

    The example is really useful!

  3. Manuel
    May 22nd, 2009 at 22:44 | #3

    okay, i really appreciate all the work done!
    This helps me a lot the get around things much easier!

    I downloaded your example, and tried to copy the relevant files into a new cakephp setup.

    This means:
    apples_controller.php
    apples/
    index.ctp
    indextable.ctp
    apple.php model (and of course getting the database + fields)

    and all the relevant files in the webroot
    (some css and the jqgrid javascript folder)

    everything works well, i can even add data items to my database (by clicking on the icon)
    but non of them shows up in my grid, i get an:
    Type: parsererror; Response: 200 OK
    error!

    what did i miss? is there anything special to it?

    cheers!

  4. Manuel
    May 22nd, 2009 at 23:38 | #4

    @Manuel
    okay, it all comes down to:
    you should set debug mode in cakephp to max 1!

  5. admin
    May 25th, 2009 at 13:44 | #5

    @Manuel
    Yes, As in debug mode 2/3,it will append sql information into the page.
    and that will cause an invalid XML data.

  6. May 29th, 2009 at 21:09 | #6

    Thank you for this great script. it works very well.

  7. Sijo
    June 9th, 2009 at 14:01 | #7

    Hi have used the JQgrid in one of my pages and made some changes so that the grid reflects to one of my tables. I have changed the debug mode to 0.

    Now also I get error Type: parsererror; Response: 200 OK and the grid is not at all loading.
    I have checked the response data with that of ur demo/apples using firebug and they look the same.

    Am I missing some thing….

  8. admin
    June 9th, 2009 at 16:26 | #8

    @Sijo
    It could be all possible reasons.
    Would you mind posting your index page which invokes jqgrid javascript here ?

  9. Sijo
    June 9th, 2009 at 19:30 | #9

    Well this is my index page for the controller UserhomeController.

    link(’jqgrid/jquery’);
    echo $javascript->link(’jqgrid/jqGrid’);
    echo $javascript->link(’jqgrid/js/jqModal’);
    echo $javascript->link(’jqgrid/js/jqDnR.js’);

    echo $html->css(’jqgrid/themes/jqModal’);
    echo $html->css(’jqgrid/themes/coffee/grid’);
    ?>

    jQuery(document).ready(function(){
    // Functions to load Leads List.
    jQuery(”#JQueryLeadList”).jqGrid({
    url:’url(’/userhome/indexLeadsList’) ?>’,
    datatype: ‘xml’,
    mtype: ‘GET’,
    colNames:['Id'],
    colModel :[
    {name:'id', index:'id', width:200},
    ],
    pager: jQuery(’#pager’),
    rowNum:10,
    rowList:[10,20,30],
    sortname: ‘id’,
    sortorder: ‘desc’,
    multiselect: false,
    viewrecords: true,
    imgpath: ‘/intacademy/app/webroot/css/jqgrid/themes/coffee/images’,
    caption: ‘Lead FollowUps’,
    editurl:”,
    height:’100′,
    loadError : function(xhr,st,err) { jQuery(”#rsperror”).html(”Type: “+st+”; Response: “+ xhr.status + ” “+xhr.statusText); },
    onSelectRow: function(ids) { }
    });

    jQuery(”#list”).navGrid(”#pager”,{edit:false,add:false,del:false});

    });

    My controller is UserHomeController and the list that i an retrieving is that of ‘Lead’ would that be a reason…

  10. Sijo
    June 9th, 2009 at 19:37 | #10

    Well when i did not get that mine working, I tried ur example of ‘Apple’ in my application. Then it is working perfectly.. That where i am stuck.

  11. admin
    June 9th, 2009 at 22:46 | #11

    @Sijo
    Is it loading xml from “/userhome/indexLeadsList” correctly and did you check whether all files needed being loaded correctly?
    you may check from firebug.

    If you need further assist, you can email me your App. I could help check .

  12. Sijo
    June 10th, 2009 at 12:40 | #12

    Well I have checked with firebug and the response is all OK.
    The format of the XML that is raised is also correct all using firebug.

    Since I am not using DatePicker and ColorPicker i have removed the corresponding links and function. All others are loading accordingly.

  13. admin
    June 18th, 2009 at 10:58 | #13

    @Sijo
    I have sent you a mail and would like to help out.

  14. bayu
    September 15th, 2009 at 20:20 | #14

    i have same problem with Sijo
    can u tell me which files needed to get this thing work?

  15. admin
    September 16th, 2009 at 21:23 | #15

    @bayu
    If you are getting error Type: parsererror; Response: 200 OK.
    Mostly it is due to invalid XML format.
    You may check on two aspects:
    1st: To check your xml content through Firebug to make sure it is getting correct xml file (without cakephp appended data)
    2nd: Make sure you have put your text data into < ![CDATA[ ]]>.

    Regards.
    Let me know if I solved your problem.

  16. Lucas
    October 15th, 2009 at 21:46 | #16

    Did someone try to use json instead of XML? maybe using json, the tables will load faster… but until now, i couldn´t make it work with json

  17. Daniyel
    October 16th, 2009 at 19:31 | #17

    I am using only jqGrid with JSON and MySQL and i have finaly made it, after a lot of hours put into it.

    PS: i am not javascript nor SQL advanced programer.

  18. October 17th, 2009 at 12:38 | #18

    @Daniyel
    Congrats~!

  19. October 28th, 2009 at 16:25 | #19

    Hi,
    I have one problem.
    I am getting this error
    Undefined index: page [APP\\controllers\\apples_controller.php, line 40]

  20. dazn
    December 7th, 2009 at 18:15 | #20

    what did i miss? coz I just get nothing (blank window)

    i\’m using easyphp 5.3.0

  21. December 8th, 2009 at 16:02 | #21

    @dazn
    Please follow the installation guide in readMe.txt
    cheers.

  22. Nams
    July 9th, 2010 at 20:48 | #22

    I am still getting a blank page even though I have made all required configuration.
    I am getting this error.
    jQuery(”#list”).jqGrid is not a function

    I have included in default.ctp

  23. July 9th, 2010 at 22:24 | #23

    @Nams Check from firebug to see if jqGrid js class file is loaded or not.

  1. No trackbacks yet.
Security Code:

Get Adobe Flash playerPlugin by wpburn.com wordpress themes