drb
30 Oct 2012, 3:27 PM
Touch 2.1.0-rc2
In 2.0.1.1 in the NestedList listchange event it is possible to set up a Grouped on the List and a Grouper on the list.getStore().
This no longer works in 2.1.0-rc2
Ext.setup({
onReady: function () {
var data = {
text: 'Groceries',
items: [{
text: 'Drinks',
gp: 'D',
items: [{
text: 'Water',
gp: "W",
items: [{
text: 'Sparkling',
gp: "S",
leaf: true
}, {
text: 'Still',
gp: "S",
leaf: true
}, {
text: 'Deep',
gp: "D",
leaf: true
}, {
text: 'Muddy',
gp: "M",
leaf: true
}]
}, {
text: 'Ale',
gp: 'A',
leaf: true
}]
}, {
text: 'Lager',
gp: "L",
leaf: true
}]
};
Ext.define('ListItem', {
extend: 'Ext.data.Model',
config: {
fields: [{
name: 'text',
type: 'string'
}, {
name: 'gp',
type: 'string'
}]
}
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'ListItem',
defaultRootProperty: 'items',
root: data
});
var nestedList = Ext.create('Ext.NestedList', {
fullscreen: true,
title: 'Groceries',
displayField: 'text',
store: store,
listeners: {
listchange: function (nlist, list) {
var liststore = list.getStore();
liststore.setGrouper({
groupFn: function (record) {
return record.get("gp");
}
});
list.setGrouped(true);
}
}
});
}
});
Thanks
David
In 2.0.1.1 in the NestedList listchange event it is possible to set up a Grouped on the List and a Grouper on the list.getStore().
This no longer works in 2.1.0-rc2
Ext.setup({
onReady: function () {
var data = {
text: 'Groceries',
items: [{
text: 'Drinks',
gp: 'D',
items: [{
text: 'Water',
gp: "W",
items: [{
text: 'Sparkling',
gp: "S",
leaf: true
}, {
text: 'Still',
gp: "S",
leaf: true
}, {
text: 'Deep',
gp: "D",
leaf: true
}, {
text: 'Muddy',
gp: "M",
leaf: true
}]
}, {
text: 'Ale',
gp: 'A',
leaf: true
}]
}, {
text: 'Lager',
gp: "L",
leaf: true
}]
};
Ext.define('ListItem', {
extend: 'Ext.data.Model',
config: {
fields: [{
name: 'text',
type: 'string'
}, {
name: 'gp',
type: 'string'
}]
}
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'ListItem',
defaultRootProperty: 'items',
root: data
});
var nestedList = Ext.create('Ext.NestedList', {
fullscreen: true,
title: 'Groceries',
displayField: 'text',
store: store,
listeners: {
listchange: function (nlist, list) {
var liststore = list.getStore();
liststore.setGrouper({
groupFn: function (record) {
return record.get("gp");
}
});
list.setGrouped(true);
}
}
});
}
});
Thanks
David