Hybrid View
-
23 Apr 2012 7:25 PM #1
Unanswered: Error delete multi selected items from list
Unanswered: Error delete multi selected items from list
Hi guys, like you can see, I want to delete multi selected items from my list but I can't get it, I have this:
List:
Code:var listaPlanFact = new Ext.List({ id: 'listaPlanFact', store: planFactStore, multiSelect: true, simpleSelect: true, onItemDisclosure: function (record) { planFactPanelEditor.load(record); planFactPanelPrincipal.setActiveItem('planFactPanelEditor', { type: 'slide', direction: 'left' }); }, itemTpl: '<div>{FecFact}</div>' + '<div>{Denomi}</div>', listeners: { 'render': function (thisComponent) { thisComponent.getStore().load(); } } });
Button:
It works fine when I delete one item selected, but when I try to delete more of that, and reload the page, I get this error message:Code:{ xtype: 'button', iconCls: 'trash', iconMask: true, handler: function () { var currentPlanFactCount = listaPlanFact.getSelectionCount(); var currentPlanFact = listaPlanFact.getSelectedRecords(); var planfactstore = listaPlanFact.getStore(); for(var i=0;i<currentPlanFactCount;i++) { if(planfactstore.findRecord('id', currentPlanFact[i].data.id)) { planfactstore.remove(currentPlanFact[i]); } planfactstore.sync(); } listaPlanFact.refresh(); } }
'Uncaught TypeError: Cannot read property 'id' of null'
What can be? Please help me.
Thanks very much for your time.
-
23 Apr 2012 8:50 PM #2
I was looking for a solution and I found this, but doesn't work for me.
http://www.sencha.com/forum/showthre...ty-xxx-of-nullCode:{name : 'firstName', mapping : 'first name', type : 'string', convert : function(val) { if (!val) { val = ''; } return val; }}
Model:
I don't know what to do.Code:Ext.regModel('planFactModel',{ idProperty: 'id', fields: [ {name: 'id', mapping : 'id', type: 'int', convert : function(val) { if (!val) { val = ''; } return val; }}, {name: 'FecFact', type: 'string'}, {name: 'Denomi', type: 'string'}, {name: 'Porc', type: 'string'}, {name: 'ValorFact', type: 'string'}, {name: 'Moneda', type: 'string'}, {name: 'Bloqueo', type: 'string'}, {name: 'RGLFact', type: 'string'}, {name: 'Status', type: 'string'}, {name: 'CPag', type: 'string'}, {name: 'CatF', type: 'string'}, {name: 'CFact', type: 'string'}, {name: 'NroHito', type: 'string'}, {name: 'Fij', type: 'string'} ] });
-
24 Apr 2012 1:07 PM #3
-
26 Apr 2012 7:41 AM #4
-
27 Apr 2012 11:16 AM #5
Hi, I just saw that when I create the first record of the store, the ID creates twice
, like you can see in the image (it is other store but happen the same thing):
1.png
Why is that?
This is my code 'save':
Please help me.Code:text: 'Save', iconCls: 'organize', iconMask: true, ui: 'action', handler: function () { var currentPlanFact = planFactPanelEditor.getRecord(); planFactPanelEditor.updateRecord(currentPlanFact); var planfactstore = listaPlanFact.getStore(); if (null == planfactstore.findRecord('id', currentPlanFact.data.id)) { planfactstore.add(currentPlanFact); } planfactstore.sync(); planFactPanelPrincipal.setActiveItem('planFactPanelLista', { type: 'slide', direction: 'right'}); }


Reply With Quote