Forum

November 2nd, 2014
A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

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

Topic RSS
2 Questions about jqGrid (Subgrid) and json(string)
11/08/2009
10:08
Arne
Guest

Hi everybody

I'm developping a web application with Java, Springframework, DWR and JQuery.

My first grid was successful.

$("#sortable").jqGrid({
   datatype: 'jsonstring',
   userdata: mydata,
   colNames:[
     '<spring:message code="label"/>',
     '<spring:message code="label"/>'
   ],
   colModel:[
     { name:'field1', index:'field1', sortable:true, sorttype:'int' },
     { name:'field2', index:'field2', sortable:false }
   ],
   emptyrecords: "<spring:message code="label"/>",
   hoverrows: true,
   toolbar: [true, "bottom"],
   width: 653,
   height: 300
});

var mydata = [
   <c:forEach var="item" items="${listAsJson}" varStatus="status">
     <c:choose>
       <c:when test="${status.last}">
         ${item}
       </c:when>
       <c:otherwise>
         ${item},
       </c:otherwise>
     </c:choose>
  </c:forEach>
];

for(var i=0;i<=mydata.length;i++) {
  $("#sortable").addRowData(i+1,mydata[i]);
}

But now I need some sub grids.

The problem is, that I don't know, how to add the rows into the sub grid. I still have all datas in the response (I'm looking for the datas in the previous Spring-Controller and add them into the request).

The second question is about json. I have objects in objects. The json string looks ok, or doesn't it?

{ "name": "test", "phone": "111",  "address": { "street": "street" } }

But if I change the ColModel to:

colModel:[
  { name:'address.street', index:'address.street' }
],

I don't get any results.

It makes me ... :S

Best regards

Arne

13/08/2009
01:53
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7720
Member Since:
30/10/2007
Offline

Hello,

http://www.trirand.com/jqgridw.....id#methods

One note (which I will correct into the docs)

If you use subGridJson you should use the method this way:

var mygrid = jQuery("#mygrid")[0];

mygrid.subGridJson(arraydata,rowid)

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/08/2009
01:56
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7720
Member Since:
30/10/2007
Offline

Hello,

About the second question.

The addRowData currently does not support this. I suggest you to use datatype as function - see docs and addJSONData method to add data. This method support this named convention.

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.
Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
37 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1245

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11350

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10559

Posts: 31230

Newest Members: ni, geneleung, benhamc, vi6cmevm, htec1, atalabaseen

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

Administrators: admin: 61

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information