javascript - ExtJS store add calls both create and destroy -



javascript - ExtJS store add calls both create and destroy -

this.store = ext.create('ext.data.store', { fields: [ 'id', 'name', 'address', 'status', ], autoload: auto, autosync: auto, remotesort: true, proxy: { type: 'ajax', api: { create: '../../create.php', read: '../../read.php', destroy: '../../destroy.php', update: '../../update.php' }, reader: { type: 'json', root: '__data', totalproperty: 'grandtotal' }, writer: { type: 'json', root: '__data' }, listeners: { exception: function( t, response, op ) { var _da = ext.decode( response.responsetext ); if( _da ) { if( _da.message == "existingname" ) { _da.message = locale.gettext('name exists'); } else { frm = _self.subneteditor.down('form'); name_field = frm.down('textfield[name=name]'); } name_field.markinvalid(locale.gettext(_da.message)); } showmsg( _da.success, _da.message ); if( op.action == 'create' || op.action == 'update' ) { _self.store.rejectchanges(); _self.store.load(); } } } } } });

this store calls 4 php files crud, , listener process duplicate name.

removeselected: function() { var _self = this; ext.msg.show( { title: locale.gettext( 'remove selected?' ), msg: locale.gettext( 'are sure want remove selected items?' ), icon: ext.msg.warning, buttons: ext.msg.okcancel, buttonalign: 'right', fn: function( button ) { if( button == 'ok' ) { var grid = _self.down( 'grid' ); if( grid ) { var selection = grid.getselectionmodel().getselection(); if( selection.length ) { _self.store.remove( selection ); if( _self.usegridrowediting ) { _self.store.sync(); } } } } } } ); }

here remove function remove selected items, , have store.add(item) add together records. problem if run remove function, , store.add add together items, store.add fire create , destroy together. sec destroy post exact info first time when run remove function. suppose store.add phone call create api in proxy, why destroy has been called?

i see remove throws exception. if exception has been thrown, mean remove action still pending? batch add together , remove together?

this not caused extjs, causes server respond "[null]". array of null considered exception, guess exception causes request becomes pending.

javascript extjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -