当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Array after change returns blank in Radgrid

问题描述:

When i change my row and bind it again with my radgrid it gives my blank row .

I want to edit my array on the base of index . Why it gives me a blank row ? I can't figure out what i am doing wrong here ?

 function btn1Click() {

var newRow = [];

var cot = 0;

var sn = document.getElementById('sno').value;

var type = document.getElementById('type').value;

var act = document.getElementById("htitle").options[document.getElementById('htitle').selectedIndex].text;

var ct = document.getElementById("job").options[document.getElementById('job').selectedIndex].text;

var db = document.getElementById('drr').value;

var cr = document.getElementById('crr').value;

var desc = document.getElementById('disc').value;

var data = [{ "SNO": 1, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 2, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 3, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 4, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 5, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 6, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 7, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 8, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 9, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 10, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 11, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 12, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 13, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 14, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr },

{ "SNO": 15, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr }

];

data[0] = [{ "SNO": 11, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr }]

console.log(data[0]);

console.log(data);

var mtv = $find("radGridView2").get_masterTableView();

mtv.set_dataSource(data); mtv.dataBind();

}

</script>

this is what my grid looks like when i change the row .

网友答案:

I got the answer by changing this

 data[0] = [{ "SNO": 11, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr }]

To

 data[0] = { "SNO": 11, "INITIAL": type, "TITLE": act, "DISC": desc, "JOB": ct, "dRR": db, "cRR": cr }

only [ ] was the problem

分享给朋友:
您可能感兴趣的文章:
随机阅读: