Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






Autoloading Tree Nodes

No Tags
UserPost

00:49
01/05/2010


retnip

New Member

posts 2

In the past, I've been able to successfully implement autoloading tree nodes.  Today, when I attempt to implement another tree grid with autoloading, the expanding of a selected row does not work.  I copied much of my existing (good) code to this new implementation.

Specifically, the root nodes load successfully.  But when I click on a '+' the image toggles to a '-' but no ajax call is made to the server to retrieve child nodes.  Very strange…as this code was working perfectly in previous implementation.  Any thoughts as to what would prevent jqGrid from issuing child node ajax calls?  Below is my config:


            $('#table-contracts-new-draft').jqGrid({
                treeGrid: true,
                treeGridModel: 'adjacency',
                ExpandColumn : 'name',
                url: '/contracts/asynccustomer/contracts' + contractsRequestParams(),
                datatype: "json",
                jsonReader : {
                    root: "rows",
                    page: "page",
                    total: "total",
                    records: "records",
                    repeatitems: true,
                    cell: "cell",
                    id: "id",
                    userdata: "userdata"
                },
                mtype: "GET",
                colNames:['Project Name', 'Sales Rep', 'Start Date', 'End Date', 'System Notes'],
                colModel: [
                {
                    name: 'name',
                    index: 'name',
                    width: 400,
                    hidden: false,
                    sortable: false
                },
                {
                    name: 'rep',
                    index: 'rep',
                    width: 200,
                    hidden: false,
                    sortable: false
                },
                {
                    name: 'startdt',
                    index: 'startdt',
                    width: 130,
                    hidden: false,
                    sortable: false
                },
                {
                    name: 'enddt',
                    index: 'enddt',
                    width: 130,
                    hidden: false,
                    sortable: false
                },
                {
                    name: 'notes',
                    index: 'sysnotes',
                    width: 400,
                    hidden: false,
                    sortable: false
                }
                ],
                height: 'auto',
                width: 'auto',
                pager: false,
                viewrecords: true,
                sortorder: "desc",
                loadError : function(xhr, status, error) {
                    console.log(xhr);
                    console.log(status);
                    console.log(error);
                    if (xhr.responseText.length > 0) {
                        $('#contracts-new-draft').replaceWith('<b>'+xhr.responseText+'</b>');
                    }
                }
            });

14:15
02/05/2010


tony

Sofia, Bulgaria

Moderator

posts 7010

Hello,

Could you please post your initial server response when the grid load data?


Regards

Tony

17:17
03/05/2010


retnip

New Member

posts 2

Here is the initial server response:

{"page":1,"total":1,"rows":[{"id":"e11d23a489cd4250a84ae0461ac0a480","cell":["First contract","Andy

Brolan","2010-04-24","2011-04-24","Version bump. Customer modified/updated.",0,null,"false","false"

]},{"id":"059c8db68dc5413ab6d84817ecb61b9b","cell":["Second contract","Andy Brolan","2010-04-24","2012-04-24"

,"Version bump. Customer modified/updated.",0,null,"false","false"]},{"id":"a7d26c163f9543b89304b6eb8da5b762"

,"cell":["Third Contract","Andy Brolan","2010-04-23","2013-03-23","Version bump. Customer modified/updated

.",0,null,"false","false"]},{"id":"777f97f4f1c443cd804037179b34efd5","cell":["Fifth contract","Andy Brolan"

,"2010-05-25","2015-05-25","Version bump. Customer modified/updated.",0,null,"false","false"]}],"records"

:4}

19:49
17/05/2010


tony

Sofia, Bulgaria

Moderator

posts 7010

Hello,

Will try to test it as soon as possible. Also I will test it with the last release.

Best Regards

Tony

07:17
14/07/2010


InsaneWookie

Member

posts 6

I think I'm having the same problem


Since upgrading from version 3.6.4 to 3.7.2 loading at once on tree grids do not seem to be working correctly.

The data loads into the grid correctly by when I click on a row to expand it out nothing happens.

If I set the rows to be expanded, they show expanded with the correct sub rows showing but clicking on the top level row does not collapse it.

It looks like it maybe something to do with the event that is fired when expanding the row. As far as I can tell the event is being triggered and run but it has no effect on the grid


Rolling back to the previous version of jqGrid solves the problem.


I have tried with both JSON and XML with no success.


If I load the sub rows on demand it seems to work correctly, but this is not what I want. I want to be able to load all rows and sub rows at once.


I would really like to be able to use the latest version as it has some bug fixes that I require.


Cheers

Rowan


08:08
14/07/2010


InsaneWookie

Member

posts 6

Never mind.

It turns out that I had a period in my rowid (eg "7.1″).


Turns out that jQuery needs special characters in the ID selector to be escaped

"If the id contains characters like periods or colons you have to escape those characters with backslashes." (http://api.jquery.com/id-selector/)


Seems there was a change the way the row was being selected which caused this to not with with ID with special characters.


I just chaged the ID to not use periods anymore


Rowan

No Tags

About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

21 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9596

Posts: 28792

Membership:

There are 10196 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7010 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information