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
2 Questions about jqGrid (Subgrid) and json(string)
11/08/2009
10:08
Avatar
Arne
Guest
Guests

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
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

13/08/2009
01:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
55 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