vgribok
30 Mar 2011, 9:00 AM
Hi,
Using Touch 1.1.0.
I tried to initialize List selected item before and after list's initComponent(), but it fails until the list was displayed at least once. So, expected behavior: selection should work after data is supplied to the list even if the list has not been shown before. After the list was displayed for the first time, selection works alright. FYI, in this particular case the list was on a floating panel. (I tried to work around the problem by trying to do initial list selection not until its parent panel 'activate' event was risen, but it appears that another bug got in the way: activate event does not seem to be fired for a floating panel.)
Here's the code:
function SelectListItem(list, itemIndex) {
//try {
if (itemIndex >= list.store.data.length)
return;
var selModel = list.getSelectionModel();
selModel.select(itemIndex); // <<<<<<<< FAILS HERE
// }
// catch (ex) {
// console.log(ex);
// }
}
Here's the exception stack:
1. Uncaught TypeError: Cannot call method 'addCls' of null
1. Ext.DataView.Ext.extend.onItemSelect sencha-touch-debug.js:22967
2. Ext.DataViewSelectionModel.Ext.extend.onSelectChange sencha-touch-debug.js:22477
3. Ext.AbstractStoreSelectionModel.Ext.extend.doMultiSelect sencha-touch-debug.js:22206
4. Ext.AbstractStoreSelectionModel.Ext.extend.doSelect sencha-touch-debug.js:22176
5. Ext.AbstractStoreSelectionModel.Ext.extend.select sencha-touch-debug.js:22157
6. SelectListItem TouchMain.js:248
7. Views.WorkOrderDetailView.Ext.extend.onActivatedWorkOrderDetailView.js:131
8. firesencha-touch-debug.js:979
9. Ext.util.Observable.Ext.extend.fireEventsencha-touch-debug.js:595
10. Ext.Anim.run.aftersencha-touch-debug.js:29733
11. Ext.Anim.Ext.extend.onTransitionEndsencha-touch-debug.js:13426
12. anonymous:5
13. (anonymous function)sencha-touch-debug.js:4428
Thank you,
Vlad.
Using Touch 1.1.0.
I tried to initialize List selected item before and after list's initComponent(), but it fails until the list was displayed at least once. So, expected behavior: selection should work after data is supplied to the list even if the list has not been shown before. After the list was displayed for the first time, selection works alright. FYI, in this particular case the list was on a floating panel. (I tried to work around the problem by trying to do initial list selection not until its parent panel 'activate' event was risen, but it appears that another bug got in the way: activate event does not seem to be fired for a floating panel.)
Here's the code:
function SelectListItem(list, itemIndex) {
//try {
if (itemIndex >= list.store.data.length)
return;
var selModel = list.getSelectionModel();
selModel.select(itemIndex); // <<<<<<<< FAILS HERE
// }
// catch (ex) {
// console.log(ex);
// }
}
Here's the exception stack:
1. Uncaught TypeError: Cannot call method 'addCls' of null
1. Ext.DataView.Ext.extend.onItemSelect sencha-touch-debug.js:22967
2. Ext.DataViewSelectionModel.Ext.extend.onSelectChange sencha-touch-debug.js:22477
3. Ext.AbstractStoreSelectionModel.Ext.extend.doMultiSelect sencha-touch-debug.js:22206
4. Ext.AbstractStoreSelectionModel.Ext.extend.doSelect sencha-touch-debug.js:22176
5. Ext.AbstractStoreSelectionModel.Ext.extend.select sencha-touch-debug.js:22157
6. SelectListItem TouchMain.js:248
7. Views.WorkOrderDetailView.Ext.extend.onActivatedWorkOrderDetailView.js:131
8. firesencha-touch-debug.js:979
9. Ext.util.Observable.Ext.extend.fireEventsencha-touch-debug.js:595
10. Ext.Anim.run.aftersencha-touch-debug.js:29733
11. Ext.Anim.Ext.extend.onTransitionEndsencha-touch-debug.js:13426
12. anonymous:5
13. (anonymous function)sencha-touch-debug.js:4428
Thank you,
Vlad.