Forum
17:46
22/05/2013
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 ?
19:02
22/05/2013
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>";
}
});
12:09
Moderators
30/10/2007
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.
14:45
Moderators
30/10/2007
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.
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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66