PDA

View Full Version : When using idProperty for grid as function, JsonWriter insert function code as output



Michael J.
7 Feb 2011, 4:21 AM
Hello. I`m using grid with JsonWriter.
I have compound key in a grid, so idProperty is not a field
I saw the usage of idProperty as a function in examples, so did I:

idProperty: function(node){
var o = new Object();

o.f1 = node.f1;
o.f2 = node.f2;
return Ext.encode(o);
}

Now, deleting from store is ok and json string to server goes smth like
{\"f1\":\"value1\",\"f2\":\"value2\"}

But when I try to update a single record json string contains function code:
{"function (node) {\n var o = new Object;\n o.f1 = node.f1;\n o.f2 = node.f2;\n return Ext.encode(o);\n}":"{\"f1\":\"value1\",\"f2\":\"value2\"}"}