Forum
20:11
18/03/2011
I use next code:
<script src="/templates/default/js/jqgrid/js/i18n/grid.locale-ru.js"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script src="/templates/default/js/jqgrid/jquery.jqGrid.js"></script>
<script type="text/javascript">
$.extend($.jgrid.defaults, { cmTemplate:{ formoptions:{ elmprefix:' ' } } );
</script>
In colModel 2 from 10 rows have elmprefix
colModel: [
{name: "id_traders", width:1, hidden:true, hidedlg:true, key:true, search:false},
{name: "title", index:"title",
sortable:true, sorttype:"text", firstsortorder:"asc",
editable:true, editrules:{required:true},
},
{name: "name", index:"name", hidden:true, hidedlg:true, search:false,
sortable:true, sorttype:"text", firstsortorder:"asc",
editable:true, editrules:{edithidden:true,required:true}, formoptions:{elmprefix:'<font color="red">(*)</font>', elmsuffix:'<br /> Уникальный идентификатор биржи. Большими буквами.'}
},
{name: "api", index:"api", search:false, hidden:true,
sortable:true, sorttype:"text", firstsortorder:"asc",
editable:true, editrules:{edithidden:true}, formoptions:{label:"Ðктивен"}
},
....... more......
If in colModel presend "formoptions:{label:"Ðктивен"}" OR more attributes - default settings cmTemplate:{ formoptions:{ elmprefix:' ' } }" do not work!
Why?
sorry my bad english
21:16
10/08/2009
Hello!
It is not a bug. The problem is that you try to use correspond to my original sugestion and not correspond to its implementation in jqGrid. You should define cmTemplate as the jqGrid parameter and not as the default setting $.jgrid.defaults.cmTemplate. Moreover you want use the setting not for all columns you can use template property of colModel instead.
For example you define
and then use it in the column where you need it:
sortable:true, sorttype:"text", firstsortorder:"asc",
editable:true, editrules:{edithidden:true}, formoptions:{label:"Ðктивен"}
}
You can look at the demo from my another sugestion.
Best regards
Oleg
12:26
18/03/2011
Thanks for support
Option with $. jgrid.defaults.cmTemplate as global settings, would be much more convenient to use
Additional info:
update script -
and in colModel
{name: "api", index:"api", search:false, hidden:true, template:myOption,
sortable:true, sorttype:"text", firstsortorder:"asc",
editable:true, editrules:{edithidden:true}, formoptions:{label:"Ðктивен", colpos:1}
},
No effects. Field api not have default options
If colModel change on :
{name: "api", index:"api", search:false, hidden:true, template:myOption,
sortable:true, sorttype:"text", firstsortorder:"asc",
editable:true, editrules:{edithidden:true},/* formoptions:{label:"Ðктивен", colpos:1}*/
},
All OK. ...... inserts in field row
In grid.base.js code is used
ts.p.colModel[i] = $.extend({}, ts.p.cmTemplate, ts.p.colModel[i].template || {}, ts.p.colModel[i]);
if (ts.p.keyIndex === false && ts.p.colModel[i].key===true) {
ts.p.keyIndex = i;
}
}
and no difference where to insert this template …
var myOption={ formoptions:{ elmprefix:' ' } }
OR
$.jgrid.defaults.cmTemplate = {};
$.jgrid.defaults.cmTemplate.formoptions = { elmprefix:' ' };
Most Users Ever Online: 715
Currently Online:
30 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