i am using custom formatter for displaying cell data which is editable cell.if i select that cell and select any other cell, cell data is getting disappeared and other cells are becoming uneditable.if i use the unformatter also it is not working.
my code is:
jQuery("#tree").jqGrid({
url:'json/jsonSamplePots.json',
datatype: "json",
mtype:'GET',
colNames: ["id", "no.", "name"],
colModel: [
{name:'id',width: 30, editable:false, align:"right",sortable:false, hidden: true, key: true},
{name:'no',width:80, editable:false, align:"left", sortable:true, sorttype:"int"},
{name:'name', width:150, editable:true, sortable:true, sorttype:"text",formatter:resourceFormatter},
],
rowNum:10,
rowList:[10,20,30],
treeGridModel:'adjacency',
treeGrid: true,
cellEdit: true,
ExpandColumn:'name',
cellsubmit : 'clientArray'});
resourceFormatter=function(cellvalue, options, rowObject)
{
var strResources='';
if( null != rowObject.name )
{
$.each(rowObject.name,function(i,Assignment)
{
if(Assignment)
{
for(i=0;i<Assignment.length;i++)
{
if(i!=0)
{
strResources=strResources+",";
}
strResources=strResources+Assignment[i].employeeName+'['+Assignment[i].assignPercent+']';
}
}
});
}
return strResources;}
my JSON is::
{
"list": [
{
"id": 16731,
"no": "1",
"name": {
"resources": [
{
"employeeID": 103,
"employeeName": "Gowri",
"assignPercent": 100
},
{
"employeeID": 108,
"employeeName": "Paul",
"assignPercent": 50
},
{
"employeeID": 111,
"employeeName": "Sarfaraz",
"assignPercent": 50.5
}
]
}
}
]}
list
property must be quoted:"list"
. The part"name":["resources":
is also wrong if you use named propertyresources
you can do this inside of object only so it should be like"name":{"resources":
or"name":[{"resources":
. Could you post the fixed JSON data, then I would answer on your main question? I recommend you verify the JSON data here. – Montemayor