プラグインを使用jqGrid
してデータ リストを表し、そのnavGrid
でデータを追加/編集/削除/表示/検索していますが、追加/編集フォームを送信すると、エラーが発生し、firebug に次のようなエラー メッセージが表示されます。
$.type is not a function
var obj = $.type( pref );
以下は、データベースからデータを取得して jqGrid に渡すコードです。
/**
* Update store of account grid.
*/
var updateGridStore = function() {
$.ajax({
type : "POST",
url : CONTEXT + "/admin/doListAccounts.action",
dataType : 'json',
success : function(response) {
if (response) {
if (response.success) {
updateAccountGrid(response);
} else {
alert(response.message);
}
} else {
alert("Failed to get accounts.");
}
},
error : function(error) {
alert("error: " + error);
}
});
};
/** * アカウント グリッドを作成または更新します。*/
var updateAccountGrid = function(response) {
jQuery("#accountGrid").jqGrid(
{
data : response.list,
scrollrows : true,
datatype : "local",
colNames : [ "ID", "True Name", "Admin", "Email",
"Mobile", "Telphone", "QQ",
"Dept", "Group", Status" ],
colModel : [ {
name : 'id',
index : 'id',
width : 50,
editable : false,
align : 'center',
editoptions : {
readonly : false,
size : 45
}
}, {
name : 'truename',
index : 'truename',
width : 140,
editable : true,
align : 'center',
editrules : {
required : true
},
editoptions : {
size : 45
}
}....],
rowNum : 25,
autowidth : true,
height : 200,
rowList : [ 25, 50, 100, 150 ],
pager : "#accountGridNav",
sortname : 'id',
viewrecords : true,
sortorder : "desc",
shrinkToFit : false,
rownumbers : true,
altRows : true,
caption : "User Accounts"
});
jQuery("#accountGrid").jqGrid('navGrid', '#accountGridNav', {
view : true
},
{
jqModal : true,
checkOnUpdate : true,
savekey : [ true, 13 ],
navkeys : [ true, 38, 40 ],
checkOnSubmit : true,
reloadAfterSubmit : false,
closeOnEscape : true,
bottominfo : "Fields marked with (*) are required"
}, {
jqModal : true,
checkOnUpdate : true,
savekey : [ true, 13 ],
navkeys : [ true, 38, 40 ],
checkOnSubmit : true,
reloadAfterSubmit : false,
closeOnEscape : true,
bottominfo : "Fields marked with (*) are required"
}, {
reloadAfterSubmit : false,
jqModal : false,
closeOnEscape : true
}, {
closeOnEscape : true
}, {
navkeys : [ true, 38, 40 ],
height : 250,
jqModal : false,
closeOnEscape : true
});
jQuery("#accountGrid").jqGrid('setGroupHeaders', {
useColSpanStyle: true,
groupHeaders:[
{startColumnName: 'email', numberOfColumns: 4, titleText: 'Contacts'},
{startColumnName: 'deptName', numberOfColumns: 2, titleText: 'Department Info'}
]
});
jQuery("#accountGrid").closest("div.ui-jqgrid-view").children(
"div.ui-jqgrid-titlebar").css("text-align", "center").children(
"span.ui-jqgrid-title").css("float", "none");
};
$.type がどこに定義されているかわかりませんか? そして、どうやってそれを処理しますか。どうもありがとう。