Forum
18:48
31/05/2010
Toolbar Search on local data gives me an error. I'm using the latest beta 3.7. The error is:
"cmtypes[st] is undefined
I fixed it by setting the st variable to this.name by default. Source grid.base.js, line 1272:
$.each(ts.p.colModel,function(i,v){
sorttype = this.sorttype || "text";
// -------> PATCH by l.garulli <-------
st = this.name;
if(sorttype == "date" || sorttype == "datetime") {
12:49
Moderators
30/10/2007
Hello,
I'm not sure if this is the appropriate fix.
Could you plase post your grid setup and all code related to it.
Thank you
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
16:14
31/05/2010
Hi,
if you check that point you can see that st could be never being defined.
This is my code to build the table at run-time depending by the type. With the above fix works.
jQuery("#output").val(
"Query executed in " + stopTimer() + " sec. Returned "
+ result.length + " record(s)");
// CREATE COLUMN NAMES
var columnNames = buildColumnNames(result);
// CREATE COLUMN MODEL
var columnModel = new Array();
columnModel.push( {
"name" : "_id",
"index" : "_id",
"width" : 30,
"classes" : "cell_readonly",
searchoptions : {
sopt : [ "cn" ]
}
});
columnModel.push( {
"name" : "_ver",
"index" : "_ver",
"width" : 30,
"classes" : "cell_readonly",
searchoptions : {
sopt : [ "cn" ]
}
});
columnModel.push( {
"name" : "_class",
"index" : "_class",
"width" : 30,
"classes" : "cell_readonly",
searchoptions : {
sopt : [ "cn" ]
}
});
columnModel.push( {
"name" : "_class",
"index" : "_className",
edittype : "select",
editoptions : {
value : classEnumeration
},
hidden : true,
editable : true,
search : false,
editrules : {
edithidden : true
}
});
var formatter;
var editFormatter;
var editOptions;
for (col in columnNames) {
editOptions = null;
unformatter = null;
if (schema && schema.properties && schema.properties[columnNames[col]]) {
var type = schema.properties[columnNames[col]].type;
switch (type) {
case 'STRING':
formatter = "text";
break;
case 'BOOLEAN':
formatter = "checkbox";
editOptions = {
value : "True:False"
};
break;
case 'EMBEDDED':
formatter = "embeddedFormatter";
break;
case 'LINK':
formatter = linkFormatter;
unformatter = linkUnformatter;
break;
case 'EMBEDDEDLIST':
formatter = "embeddedListFormatter";
break;
case 'LINKLIST':
formatter = "linkListFormatter";
break;
case 'EMBEDDEDSET':
formatter = "embeddedSetFormatter";
break;
case 'LINKSET':
formatter = "linkSetFormatter";
break;
default:
formatter = "text";
}
} else
formatter = "text";
editFormatter = formatter;
if (col.charAt(0) !== '_') {
columnModel.push( {
name : columnNames[col],
editable : true,
index : columnNames[col],
width : 80,
formatter : formatter,
unformat : unformatter,
// edittype : editFormatter,
editoptions : editOptions,
search : true,
searchoptions : {
sopt : [ "cn" ]
}
});
}
}
var lastsel;
jQuery($('#queryResultTable')).jqGrid('GridUnload');
fillDynaTable($('#queryResultTable'), "Resultset", columnNames,
columnModel, result, {
sortname : 'id',
width : 400,
height : 300,
editurl : getStudioURL('document'),
onSelectRow : function(id) {
if (id && id !== lastsel) {
jQuery('#queryResultTable').jqGrid('restoreRow',
lastsel);
lastsel = id;
}
var recId = jQuery('#queryResultTable').jqGrid(
'getRowData', id)["_id"];
jQuery('#queryResultTable').jqGrid('editRow', id, true,
null, function(response, postdata) {
jQuery("#output").val(response.responseText);
return true;
}, getStudioURL('document'), [ recId ]);
}
}, true);
17:55
Moderators
30/10/2007
Hello,
I do not see the code where the filterToolbar is defined.
Note that the filterTollbar searching in local mode works only when the parameter stringResult is set to true. See the 3.7 Beta demo.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
14:43
03/06/2010
Hi I just had the same error, in my case I was using a sortname on a column I didn't use anymore.
I see you have your sortname defined as 'id', althought the column's name is '_id',
so maybe changing sortname: 'id' to sortname: '_id' could fix it.
It still would be useful if some kind of exception was throw if something like this occurs, could save a lot of time debugging things like this.
17:58
Moderators
30/10/2007
Hello,
The problem is fixed. Also I have set the behaviour so that when a local data is used and a filterToolbar is called the stringResult parameter is set to true.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
18:21
24/04/2010
The problem is fixed. ...
I have the same error in jqGrid 3.8.1 !!! , and had to apply
// ——-> PATCH by l.garulli <——-
st = this.name;
else st is undefined , and then "Error: cmtypes[st] is undefined"
the table is very simple, and failure happens during initialization call
$("#tbl"+tt).jqGrid({
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn : 'name',
ExpandColClick: true,
rowNum: 0,
datatype: "local",
//multikey: "ctrlKey",
multiselect: true,
height: szh.h, width: szh.w,
//caption: "",
jsonReader: {
repeatitems: false,
id: "id",
parent: "parent",
},
colNames:[ 'I','Id','Name','Comment',//'Parent'
],
colModel:[
{key:true, name:'id',index:'id', width:50, hidden:true},
{name:'idn',index:'idn', width:50, hidden:false},
{name:'name',index:'name', editable:false, width:450, },
{name:'comment',index:'comment',editable:false, width: szh.w - 500, sorttype:"string"},
],
pager: "#ptbl"+tt,
pagerpos: false,
//rownumbers: true,
loadError: function(xhr,ts,err) {
alert(ts+"\n"+ err +"\n"+xhr.responseText);
},
gridComplete: function() { },
ondblClickRow: function(idd,ord,col,event,more) {
if(col==1) add_gr_ct(event.ctrlKey);
},
});
Most Users Ever Online: 715
Currently Online:
21 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66