首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

效能: 用户点击grid的表头菜单显示/隐藏列,拉动列、重新刷新页面后保留

2012-11-01 
功能: 用户点击grid的表头菜单显示/隐藏列,拉动列、重新刷新页面后保留。var?grid??new?Ext.grid.GridPanel

功能: 用户点击grid的表头菜单显示/隐藏列,拉动列、重新刷新页面后保留。

    var?grid?=?new?Ext.grid.GridPanel({ ??????width:?400, ??????height:?200, ??????autoScroll:?true, ??????trackMouseOver:false, ??????ddGroup:'myDDGroup', ??????sm:new?Ext.grid.CellSelectionModel({}), ??????cm:?new?Ext.grid.ColumnModel({ ????????columns:[ ????????????{header:?'序号',?dataIndex:?'id',?sortable:?true?}, ????????????{header:?'名字',?dataIndex:?'name',?sortable:?true}, ????????????{header:?'描述',?dataIndex:?'descript',?sortable:?true} ??????????] ??????}), ??????viewConfig:{ ????????forceFit:true??????}, ??????renderTo:Ext.getBody(), ??????store:new?Ext.data.SimpleStore({ ????????fields:['id','name','descript'], ????????data:[ ??????????[1,'name001','this?is?name001'], ??????????[2,'name002','this?is?name002'], ??????????[3,'name003','this?is?name003'], ??????????[4,'name004','this?is?name004'] ????????] ??????}), ?????? ??????stateful:true,???//开启状态????stateId:'cookiegrid'?//cookie});??

stateId : String
The unique id for this component to use for state management purposes (defaults to the component id if one was set, otherwise null if the component is using a generated id).
See stateful for an explanation of saving and restoring Component state.
Ext自带的这个stateful,这个保持状态能保持多久?用户注销后重新登录就失效了,能否设置这个cookie的时间?

//自定义列在cookie中保存一年

# Ext.state.Manager.setProvider(?
#?????? new Ext.state.CookieProvider({?
#???????? expires: new Date(new Date().getTime()+(1000*60*60*24*365))?
#?????? })?
#???? );?

热点排行