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
Grouping + Custom Formatter ... how to get group name information for group summary row ?
24/01/2014
17:46
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

I am trying to use grouping + group summary + custom formatter for my cells.  The custom formatter returns a link based on various filters which have been applied to the grid.  For the most part this is working great for me, the only problem that I am running into is that the custom formatter is also being applied to the group summary row.   I can disable the formatter in this case, but i dont want to.  I want to be able to detect the text of the group name and format the link for the group summary based on that, but there is no way that i can currently find to get access to that information. the rowObject does not have a rowID for the summary row and the three inputs to the custom formatter function (cellvalue, options, rowObject) do not have any useful information for detecting the value i need. 

I can write up a basic example if necessary , but does anyone have any ideas on how to accomplish something like this ?

24/01/2014
19:02
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

I modified one of the jqgrid examples to show what i am trying to do.  If you load it and hover over the link in the group summaries you see that the title is 'undefined'.  What i am trying to do is see that the grouping is based on the "name" field, so i want to include the name in the link, but as far as i can tell i do not have access to that value.  

$(document).ready(function() {

var mydata = [

{id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},

{id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},

{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},

{id:"4",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},

{id:"5",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},

{id:"6",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},

{id:"7",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},

{id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},

{id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}

];

$("#list4″).jqGrid({

datatype: "local",

data:mydata,

height: 'auto',

colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],

colModel:[

{name:'id',index:'id', width:60, sorttype:"int"},

{name:'invdate',index:'invdate', width:90, sorttype:"date"},

{name:'name',index:'name', width:100},

{name:'amount',index:'amount', width:80, align:"right",sorttype:"float",summaryType:'sum',formatter:cellFormat},

{name:'tax',index:'tax', width:80, align:"right",sorttype:"float",summaryType:'sum',formatter:cellFormat},

{name:'total',index:'total', width:80,align:"right",sorttype:"float",summaryType:'sum',formatter:cellFormat},

{name:'note',index:'note', width:150, sortable:false}

],

grouping:true,

groupingView:

{

groupField:['name'],

groupColumnShow:[true],

groupCollapse:false,

groupDataSorted:true,

groupSummary:[true],

showSummaryOnHide:true,

groupText:["{0}"]

},

caption: "Manipulating Array Data"

});

function cellFormat(cellvalue,options,rowObject) {

objname = rowObject.name;

return "<a href='javascript:void();' title='" + objname + "'>" + cellvalue + "</a>";

}

});

29/01/2014
15:15
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

still looking for help on this one.  Is it a limitation of jqgrid right now ?

31/01/2014
12:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Try with the following function.

function cellFormat(cellvalue,options,rowObject) {

  var objname = rowObject.name ? rowObject.name : rowObject.nm;

  return "<a href='javascript:void();' title='" + objname + "'>" + cellvalue + "</a>";

}

rowObject in the summary has the following properties:

nm => name from colModel

srt => summary round type usually round

st => summary type (sum,avg,...)

v =>value

Hope thsi helps.

Regards

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.

31/01/2014
13:53
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

Thanks Tony, but rowObject.nm appears to be the current column name, not the column name (or text value) of the group name. 

Seen here, i want the title to be "test" since that is the group name, not "amount" which is the current column name for this summary cell. 

Image Enlarger

31/01/2014
14:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Sorry that I do not understand fully the requierment.

I have aded some other parameters of this object. Will be available in the next release.

Look here

Now you can use groupValue to get what you need.

Regards

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.

31/01/2014
14:53
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

Thanks, will wait and try it in the next release

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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