得到的数据{"total":3,"rows":[{"id":"3","username":"hxtgirq","password":"703353AC0A44CED5","question":"","answer":"","groupid":"4","regtime":"2011072701","lastlogintime":"0","logintimes":"0","ischecked":"0","realname":"","sex":"1","telphone":"","fax":"","email":"","address":""},{"id":"2","username":"test","password":"A26A5810D25C89F3","question":"test","answer":"test","groupid":"3","regtime":"1303312096","lastlogintime":"1303312096","logintimes":"0","ischecked":"1","realname":"","sex":"1","telphone":"","fax":"","email":"","address":""},{"id":"1","username":"admin","password":"873DBA6942DF1DD6","question":"","answer":"dd","groupid":"1","regtime":"1230768000","lastlogintime":"1230768000","logintimes":"0","ischecked":"1","realname":"","sex":"1","telphone":"15478523657","fax":"","email":"[email protected]","address":"天堂街"}]}
方法 function IntiGrid() {
$("#Grid").datagrid({
url: "",
loadMsg: "数据加载中......",
border: false,
frozenColumns: [[
{ field: 'ck', checkbox: true }
]],
columns: [[
{ field: "id", title: "编号", width: 100 },
{ field: "username", title: "用户名", width: 100 },
{ field: "groupid", title: "类型", width: 100 },
{ field: "ischecked", title: "是否锁定", width: 60 },
{ field: "regtime", title: "注册时间", width: 100 }
]],
toolbar: [
{ id: 'reload', text: '刷新', iconCls: 'icon-reload', handler: function () { } },
{ id: 'add', text: '添加', iconCls: 'icon-add', handler: function () { alert("710"); } }
]
});
}
function GetData() {
$.ajax({
url: '../Ajax/System710/MemberAjax.ashx',
type: 'Post',
datatype: 'json',
data: 'active=Sel',
success: function (data) {
alert(data);
$("#Grid").datagrid("loadData", data);
alert(data);
},
error: function (data) {
alert(data.responseText);
}
});
}
方法 function IntiGrid() {
$("#Grid").datagrid({
url: "",
loadMsg: "数据加载中......",
border: false,
frozenColumns: [[
{ field: 'ck', checkbox: true }
]],
columns: [[
{ field: "id", title: "编号", width: 100 },
{ field: "username", title: "用户名", width: 100 },
{ field: "groupid", title: "类型", width: 100 },
{ field: "ischecked", title: "是否锁定", width: 60 },
{ field: "regtime", title: "注册时间", width: 100 }
]],
toolbar: [
{ id: 'reload', text: '刷新', iconCls: 'icon-reload', handler: function () { } },
{ id: 'add', text: '添加', iconCls: 'icon-add', handler: function () { alert("710"); } }
]
});
}
function GetData() {
$.ajax({
url: '../Ajax/System710/MemberAjax.ashx',
type: 'Post',
datatype: 'json',
data: 'active=Sel',
success: function (data) {
alert(data);
$("#Grid").datagrid("loadData", data);
alert(data);
},
error: function (data) {
alert(data.responseText);
}
});
}
function IntiGrid() {
$("#Grid").datagrid({
url: "../Ajax/System710/MemberAjax.ashx",
loadMsg: "数据加载中......",
border: false,
frozenColumns: [[
{ field: 'ck', checkbox: true }
]],
columns: [[
{ field: "id", title: "编号", width: 100 },
{ field: "username", title: "用户名", width: 100 },
{ field: "groupid", title: "类型", width: 100 },
{ field: "ischecked", title: "是否锁定", width: 60 },
{ field: "regtime", title: "注册时间", width: 100 }
]],
toolbar: [
{ id: 'reload', text: '刷新', iconCls: 'icon-reload', handler: function () { } },
{ id: 'add', text: '添加', iconCls: 'icon-add', handler: function () { } }
]
});
}
但是为什么我那样写就要报错呢
火狐 row is undefined
IE 'length'为空或不是对象
datatype:"json"
改成
dataType="json"
就可以了
我淡定了,浪费我半天时间