how to get Extjs Store last insert id? -
i use rest proxy, want know last 'id' of last insert record, server side respond should be:
before saving:
id:-1
save:
var values = this.getfrmreciept().getvalues(); var record = this.getfrmreciept().getrecord(); var store = ext.getstore('recstore'); record.set(values); record.save(); store.add(record); alert(record.data.id);//result '-1'
respond server:
{"success":true,"reciept":[{"id":"366","c_id":"57","crdt_auth":"test","typ":"2","clerk_id":"1"}]}
after saving use same record new 'id':
alert(record.data.id);//result '-1'
how can new 'id' returned server?
thank in advice
var newid = -1; record.save({ success: function (rec, op) { newid = rec.getid(); alert(newid); } });
Comments
Post a Comment