EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: aswzen on September 24, 2014, 12:32:02 AM



Title: is it possible to make groupView only group the item that more than 1?
Post by: aswzen on September 24, 2014, 12:32:02 AM
is it possible to make groupView only group the item that more than 1?
i just wondering how to do that..
because i have only 20% items from 15000 that should be grouped and the other not ..

thanks in advance...


Title: Re: is it possible to make groupView only group the item that more than 1?
Post by: stworthy on September 24, 2014, 03:41:51 AM
Please describe your question in more detail.


Title: Re: is it possible to make groupView only group the item that more than 1?
Post by: aswzen on September 24, 2014, 04:31:39 AM
just look at the pic below..
(http://i.imgur.com/jkTIyih.jpg)

you see..that Computer and Microphone just only have 1 item..and the Lighting have 3 items like in the top picture..
and i want the table only grouped if the Item is more than 1 just like in the bottom pic..

is it possible?

thanks


Title: Re: is it possible to make groupView only group the item that more than 1?
Post by: stworthy on September 24, 2014, 07:05:24 AM
Please try the following code:
Code:
$('#dg').datagrid({
view:groupview,
onLoadSuccess:function(){
var state = $.data(this, 'datagrid');
var opts = state.options;
var body = state.dc.body1.add(state.dc.body2);
var groups = opts.view.groups;
$.map(groups, function(group,index){
if (group.rows.length == 1){
var g = body.children('div.datagrid-group[group-index="'+index+'"]');
g._outerHeight(0)
}
})
}
})