Forum
06:47
20/09/2010
Hello guys. I am new to the forum, so I beg your pardon if I am asking a silly question or if I trespass any local rules.
I am using JqGrid in TreeGrid mode for site navigation purposes. The usage is pretty simple and the tree is loaded only once upon site load so using adjacency mode sounded like a good option. Anyway, the problem I am facing is that it works up to a certain point. I've reached a stage where I simply can't add more nodes to it because it will break. The symptom is that the last node may hide its descendants as well as siblings and when clicked, the entire tree is requested again and appended to it. Not sure why this happens and why exactly at this point since the rest of the tree is working just fine.
Here's the code:
jQuery("#west-grid").jqGrid({
url: "${h.url_for(controller='desktop', action='menuTree')}",
datatype: "xml",
height: "auto",
pager: false,
loadui: "disable",
colNames: ["id",'${_("Menu Options")}',"url"],
colModel: [
{name: "id",width:1,hidden:true, key:true},
{name: "menu", width:150, resizable: false, sortable:false, align: 'left'},
{name: "url",width:1,hidden:true}
],
treeGrid: true,
treeGridModel: "adjacency",
ExpandColumn: "menu",
autowidth: true,
ExpandColClick: true,
treeIcons: {leaf:'ui-icon-document-b'},
onSelectRow: function(rowid) {
var treedata = $("#west-grid").jqGrid('getRowData',rowid);
if(treedata.isLeaf=="true") {
$("#contentPane").load(treedata.url);
}
},
loadError: function(xhr, status, error) {
alert('${_("An error occured while loading your menu list. Please report this bug.")}');
}
});
It works when I supply the following XML:
<rows>
<page>1</page>
<total>1</total>
<records>1</records>
<row id="1">
<cell>1</cell>
<cell><![CDATA[Dashboard]]></cell>
<cell/>
<cell>0</cell>
<cell>None</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="4">
<cell>4</cell>
<cell><![CDATA[Example]]></cell>
<cell><![CDATA[/dashboard/example]]></cell>
<cell>1</cell>
<cell>1</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="2">
<cell>2</cell>
<cell><![CDATA[Configuration]]></cell>
<cell/>
<cell>0</cell>
<cell>None</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="5">
<cell>5</cell>
<cell><![CDATA[General Settings]]></cell>
<cell/>
<cell>1</cell>
<cell>2</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="10">
<cell>10</cell>
<cell><![CDATA[Servers]]></cell>
<cell><![CDATA[/Servers/index]]></cell>
<cell>2</cell>
<cell>5</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="11">
<cell>11</cell>
<cell><![CDATA[IP Addressses/FQDN]]></cell>
<cell><![CDATA[/IPAddress/index]]></cell>
<cell>2</cell>
<cell>5</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="6">
<cell>6</cell>
<cell><![CDATA[System Configuration]]></cell>
<cell/>
<cell>1</cell>
<cell>2</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="12">
<cell>12</cell>
<cell><![CDATA[Vendors]]></cell>
<cell><![CDATA[/Vendors/index]]></cell>
<cell>2</cell>
<cell>6</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="13">
<cell>13</cell>
<cell><![CDATA[Cutomers]]></cell>
<cell><![CDATA[/Customers/index]]></cell>
<cell>2</cell>
<cell>6</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="14">
<cell>14</cell>
<cell><![CDATA[LCRs]]></cell>
<cell><![CDATA[/LCRs/index]]></cell>
<cell>2</cell>
<cell>6</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="7">
<cell>7</cell>
<cell><![CDATA[User Management]]></cell>
<cell/>
<cell>1</cell>
<cell>2</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="15">
<cell>15</cell>
<cell><![CDATA[Users]]></cell>
<cell><![CDATA[/Users/index]]></cell>
<cell>2</cell>
<cell>7</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="16">
<cell>16</cell>
<cell><![CDATA[Groups]]></cell>
<cell><![CDATA[/Groups/index]]></cell>
<cell>2</cell>
<cell>7</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="17">
<cell>17</cell>
<cell><![CDATA[Roles]]></cell>
<cell><![CDATA[/Roles/index]]></cell>
<cell>2</cell>
<cell>7</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="3">
<cell>3</cell>
<cell><![CDATA[Reports]]></cell>
<cell/>
<cell>0</cell>
<cell>None</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="8">
<cell>8</cell>
<cell><![CDATA[Customers]]></cell>
<cell/>
<cell>1</cell>
<cell>3</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="18">
<cell>18</cell>
<cell><![CDATA[Daily]]></cell>
<cell><![CDATA[/Reports/CustomerByDate_render]]></cell>
<cell>2</cell>
<cell>8</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="9">
<cell>9</cell>
<cell><![CDATA[Snapshot]]></cell>
<cell/>
<cell>1</cell>
<cell>3</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="19">
<cell>19</cell>
<cell><![CDATA[Last 200 Calls]]></cell>
<cell><![CDATA[/Reports/last_200_render]]></cell>
<cell>2</cell>
<cell>9</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="20">
<cell>20</cell>
<cell><![CDATA[Last 200 LCR Lookups]]></cell>
<cell><![CDATA[/Reports/last_200_LCRLookups_render]]></cell>
<cell>2</cell>
<cell>9</cell>
<cell>true</cell>
<cell>false</cell>
</row>
</rows>
It doesn't work when I supply the following XML. Notice that there's only one additional node that is a "Reports" children and that has a child of it's own.
<rows>
<page>1</page>
<total>1</total>
<records>1</records>
<row id="1">
<cell>1</cell>
<cell><![CDATA[Dashboard]]></cell>
<cell/>
<cell>0</cell>
<cell>None</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="4">
<cell>4</cell>
<cell><![CDATA[Example]]></cell>
<cell><![CDATA[/dashboard/example]]></cell>
<cell>1</cell>
<cell>1</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="2">
<cell>2</cell>
<cell><![CDATA[Configuration]]></cell>
<cell/>
<cell>0</cell>
<cell>None</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="5">
<cell>5</cell>
<cell><![CDATA[General Settings]]></cell>
<cell/>
<cell>1</cell>
<cell>2</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="11">
<cell>11</cell>
<cell><![CDATA[Servers]]></cell>
<cell><![CDATA[/Servers/index]]></cell>
<cell>2</cell>
<cell>5</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="12">
<cell>12</cell>
<cell><![CDATA[IP Addressses/FQDN]]></cell>
<cell><![CDATA[/IPAddress/index]]></cell>
<cell>2</cell>
<cell>5</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="6">
<cell>6</cell>
<cell><![CDATA[System Configuration]]></cell>
<cell/>
<cell>1</cell>
<cell>2</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="13">
<cell>13</cell>
<cell><![CDATA[Vendors]]></cell>
<cell><![CDATA[/Vendors/index]]></cell>
<cell>2</cell>
<cell>6</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="14">
<cell>14</cell>
<cell><![CDATA[Cutomers]]></cell>
<cell><![CDATA[/Customers/index]]></cell>
<cell>2</cell>
<cell>6</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="15">
<cell>15</cell>
<cell><![CDATA[LCRs]]></cell>
<cell><![CDATA[/LCRs/index]]></cell>
<cell>2</cell>
<cell>6</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="7">
<cell>7</cell>
<cell><![CDATA[User Management]]></cell>
<cell/>
<cell>1</cell>
<cell>2</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="16">
<cell>16</cell>
<cell><![CDATA[Users]]></cell>
<cell><![CDATA[/Users/index]]></cell>
<cell>2</cell>
<cell>7</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="17">
<cell>17</cell>
<cell><![CDATA[Groups]]></cell>
<cell><![CDATA[/Groups/index]]></cell>
<cell>2</cell>
<cell>7</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="18">
<cell>18</cell>
<cell><![CDATA[Roles]]></cell>
<cell><![CDATA[/Roles/index]]></cell>
<cell>2</cell>
<cell>7</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="3">
<cell>3</cell>
<cell><![CDATA[Reports]]></cell>
<cell/>
<cell>0</cell>
<cell>None</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="8">
<cell>8</cell>
<cell><![CDATA[Customers]]></cell>
<cell/>
<cell>1</cell>
<cell>3</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="19">
<cell>19</cell>
<cell><![CDATA[Daily]]></cell>
<cell><![CDATA[/Reports/CustomerByDate_render]]></cell>
<cell>2</cell>
<cell>8</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="9">
<cell>9</cell>
<cell><![CDATA[Vendors]]></cell>
<cell/>
<cell>1</cell>
<cell>3</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="20">
<cell>20</cell>
<cell><![CDATA[Daily]]></cell>
<cell><![CDATA[/Reports/VendorByDate_render]]></cell>
<cell>2</cell>
<cell>9</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="10">
<cell>10</cell>
<cell><![CDATA[Snapshot]]></cell>
<cell/>
<cell>1</cell>
<cell>3</cell>
<cell>false</cell>
<cell>false</cell>
</row>
<row id="21">
<cell>21</cell>
<cell><![CDATA[Last 200 Calls]]></cell>
<cell><![CDATA[/Reports/last_200_render]]></cell>
<cell>2</cell>
<cell>10</cell>
<cell>true</cell>
<cell>false</cell>
</row>
<row id="22">
<cell>22</cell>
<cell><![CDATA[Last 200 LCR Lookups]]></cell>
<cell><![CDATA[/Reports/last_200_LCRLookups_render]]></cell>
<cell>2</cell>
<cell>10</cell>
<cell>true</cell>
<cell>false</cell>
</row>
</rows>
Pointers are greatly appreciated. I might be overlooking something. It is quite common in me .
Best regards to all.
17:03
20/09/2010
paradoz said:I have the exact same issue
paradoz, I have migrated to http://www.jstree.com/ and everything is working like a charm. No big deal to port the code.
Most Users Ever Online: 715
Currently Online:
43 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