当我改变我的行并再次将其与我的radgrid绑定时,它会给出我的空白行。 我想在索引的基础上编辑我的数组。为什么它给我一个空白行?我无法弄清楚我在这里做错了什么?
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>
答案 0 :(得分:0)
我通过更改
得到了答案 data[0] = [{ "SNO": 11, "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 }
仅 [] 是问题