123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- /*ext模板
- ==============================================*/
- var grid="";
- var dataModel="";
- var ds="";
-
- Ext.onReady(function(){
- //ext准备方法开始
- Ext.QuickTips.init();
- //定义读取数据的模版
- dataModel = Ext.data.Record.create([
- { name:'id',mapping:'id'},
- { name:'name',mapping:'name'},
- { name:'funcPermission',mapping:'funcPermission'},
- { name:'checkFlag',mapping:'checkFlag'}
- ]);
- //定义列模板
- var sm = new Ext.grid.CheckboxSelectionModel();
- var colModel = new Ext.grid.ColumnModel([
- new Ext.grid.RowNumberer({width:30}),
- sm,
- {
- id:'id',
- header:"模块id",
- hidden:true,
- dataIndex:'id',
- width:50},
- {
- id:'name',
- header:"模块名",
- dataIndex:'name',
- width:210},
- {
- id:'funcPermission',
- header:"功能权限",
- dataIndex:'funcPermission',
- hidden:false,
- width:78,
- fixed:true,
- align:'left' ,
- editor: new Ext.form.ComboBox({
- store:Ideal.ComboBoxR.getStore(parent.dicContainer[184].childrenJson),
- displayField:'name',
- typeAhead: false,
- valueField:'value',
- forceSelection:true,
- hiddenName :'ILocked',
- lazyRender :true,
- readOnly : true,
- mode: 'local',
- triggerAction: 'all',
- listClass: 'x-combo-list-small'
- }),
- renderer:Ideal.ComboBoxR.getRenderer},
- {
- id:'checkFlag',
- header:"选择标志",
- dataIndex:'checkFlag',
- hidden:true}
- ]);
-
- //定义存储器,从后台读取json数据
- ds = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({url: prjContextPath+'/moduleAction!queryModuleListByRoleId.action'}),
- reader: new Ext.data.JsonReader({root: 'data'},dataModel)
- });
-
- //定义列表对象
- grid = new Ext.grid.EditorGridPanel({
- ds: ds,
- clicksToEdit:1,
- cm: colModel,
- selModel: sm,
- frame:false,
- border:false,
- width:400,
- height:260
- });
-
- /*默认选中发送对象*/
- grid.store.on("load",function(){
- var total = grid.getStore().getCount();//数据行数
- var arr = new Array();
- for(var i=0;i<total;i++){
- checkFlag = grid.getView().getCell(i,5).innerText;
- if(checkFlag==1){
- arr[i] = i;
- }
- }
- grid.getSelectionModel().selectRows(arr,true);
- },this);
-
- grid.render('grid-rolemodule');
- ds.load({params:{id:roleid}});
- //ext准备方法结束
- });
- /****************************************** 自定义函数 ********************************************************************************/
- function saveData() {
- var m = grid.getSelections();
- var jsonData = "[";
- for ( var i = 0, len = m.length; i < len; i++ ){
- var ss = Ext.util.JSON.encode(m[i].data);
- if ( i==0 )
- jsonData = jsonData + ss;
- else
- jsonData = jsonData + "," + ss;
- }
- jsonData = jsonData + "]";
- return;
- //end
- Ext.Ajax.request({
- url : prjContextPath+'/moduleAction!updateModuleRole.action',
- params:{data:jsonData,id:roleid},
- method: 'post',
- success: function ( result, request) {
- closeWindow();
- },
- failure: function ( result, request) {
- }
- });
- }
- function closeWindow(){
- parent.maindataFrame.closeWindow();
- }
|