View Full Version : Extend sencha multiselect to select by group

6 Dec 2011, 11:41 PM

I'm trying to extend the MultiSelect plugins put together by Mitchell Simoens at http://simoens.org/Sencha-Projects/demos/

I'd like a plugin which selects all child list elements when the items are grouped and group header is tapped. If I override the getList method then I can group the items together but I don't know how to raise an event when the header group is tapped.

Any ideas?
getList: function () {
var config = this.itemConfig || {};
Ext.applyIf(config, {
xtype: "list",
store: this.store,
grouped: this.grouped,
itemId: "list",
scroll: false,
multiSelect: this.multiSelect,
simpleSelect: this.multiSelect,
itemTpl: [
'<span class="x-list-label">{' + this.displayField + '}</span>',
'<span class="x-list-selected"></span>'
groupTpl: [
'<tpl for=".">',
'<div class="x-list-group x-group-{id}">',
'<h3 class="x-list-header"><a class="selectgroup">{group}</a></h3>',
'<div class="x-list-group-items">',
'<span class="x-list-selected"></span>'
],return config;

9 Dec 2011, 10:59 AM
To capture the tap event on an element, you can do this:

cmp.mon(cmp.el, {
scope : cmp,
delegate : 'div.x-list-group',
tap : function(e, t) {...}