PDA

View Full Version : startEdit throws error in finishRender?



mice-pace
13 Mar 2013, 8:34 PM
I have a button which is meant to add a row to a grid then open it for editing, but i'm getting a really long callback on an error when i attempt to do so... for reference here's a summarised version of the code i run:


var store = grid.getStore();
var length = store.snapshot.length;

//[Code Summarised...]

var newTask = {display:true, step:0, trade:'Test Trade 2', personnel:{}, quote:'', invoice:'', description:'', hours:0, rate:0, quantity:0, unit:'each', unitcost:0, billed:0, Id:0};

//[Code Summarised...]

store.insert(length, newTask);
grid.getPlugin('scopeEditor').startEdit(length, 0);

which throws the following error and callback:

42384

mitchellsimoens
15 Mar 2013, 11:42 AM
why not just:


var rec = store.add(newTask),
plugin = grid.getPlugin('scopeEditor');

plugin.startEdit(rec, 0);

mice-pace
17 Mar 2013, 2:29 PM
Well, I used insert because I need to add the record at the end... However, while I realised Add() returns the model, for some reason i didn't realise Insert() did as well... So I'm going to try half of your advice, and call StartEdit() with the record instead of the index and let you know if that solves my problem.

mice-pace
17 Mar 2013, 2:43 PM
Hmm. Well no more errors... And yet the editor still doesn't open.

Well I guess that's half? the problem solved...

Edit (from my computer): Release Notes for Ext JS 4.1.1

( ...and from the documentation):

Could this return inserted Model instances to keep it consistent with add method? (fixed in 4.1.3)