EasyUI Forum
May 20, 2024, 07:19:27 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: PropertyGrid expandGroup/collaseGroup by GroupName?  (Read 4319 times)
tenly
Newbie
*
Posts: 7


View Profile
« on: July 18, 2015, 06:42:19 PM »

I hope this is an easy question.

Is there a syntax that I can use to expand/collapse groups in a property grid by group name instead of group index?

Thanks in advance!
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 19, 2015, 02:30:32 AM »

Extend a 'groups' method to get all the groups.
Code:
$.extend($.fn.propertygrid.methods, {
groups: function(jq){
var opts = jq.propertygrid('options');
return opts.showGroup ? jq.datagrid('options').view.groups : [];
}
});

To expand/collapse a group, calculate the group index and then call 'expandGroup' or 'collpaseGroup' methods to achieve it.
Code:
var groupName = 'Status';
var pg = $('#pg');
var groups = pg.propertygrid('groups');
var index = $.inArray(groupName, $.map(groups, function(g){return g.value}));
pg.propertygrid('collapseGroup', index);
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!