[size=medium]jqgrid在4.1.2以前的版本里不支持frozenColumn功能,在2011-12-12新出的4.3.0版本里新加了该功能,在colmodel_options里添加了
[b][color=red]frozen:默认为false.当我们需要对该列进行冻结锁定显示时只需要将其设置为true.如需多列锁定,在需要锁定的多列里添加该参数为true.[/color][/b]
这时要想达到我们的效果还需要通过方法[color=red][b]setFrozenColumns[/b][/color]来实现:
[color=red]jQuery("#ztab").jqGrid('setFrozenColumns');[/color]
例子如下:
$("#overseaPersonnelList").jqGridFunction({
datatype: "local",
colModel:[
{name:"id",index:"id",hidden:true,[color=red]frozen:true[/color]},
{name:"操作",index:'id',width:50,formatter:operateFormatter,sortable:false,[color=red]frozen:true[/color]},
{name:"englishName",index:'englishName',label:'英文名',width:80,formatter:nameFont,[color=red]frozen:true[/color]},
{name:'certificateNo',label:'证件号码',width:160},
{name:'certificateType',label:'证件种类',width:100},
{name:'name',label:'姓名',width:100},
{name:"gender",label:'性别',width:50,align:'center',formatter:genderFormatter },
{name:'currentAddress',label:'现居地址',width:150},
{name:"logOut",sortable:false,hidden:true,hidedlg:true,width:100}
],
loadComplete: afterLoad,
multiselect:true,
onSelectRow:selectRow
});
[color=red]jQuery("#overseaPersonnelList").jqGrid('setFrozenColumns');[/color]
[b][color=blue]注:当是多列需要该功能时,需要将这些列放置到一起,需要锁定的列中间不可以有别的不需要锁定列,不然被中断的后续列将不再被锁定。[/color][/b]
[/size]
[b][color=red]frozen:默认为false.当我们需要对该列进行冻结锁定显示时只需要将其设置为true.如需多列锁定,在需要锁定的多列里添加该参数为true.[/color][/b]
这时要想达到我们的效果还需要通过方法[color=red][b]setFrozenColumns[/b][/color]来实现:
[color=red]jQuery("#ztab").jqGrid('setFrozenColumns');[/color]
例子如下:
$("#overseaPersonnelList").jqGridFunction({
datatype: "local",
colModel:[
{name:"id",index:"id",hidden:true,[color=red]frozen:true[/color]},
{name:"操作",index:'id',width:50,formatter:operateFormatter,sortable:false,[color=red]frozen:true[/color]},
{name:"englishName",index:'englishName',label:'英文名',width:80,formatter:nameFont,[color=red]frozen:true[/color]},
{name:'certificateNo',label:'证件号码',width:160},
{name:'certificateType',label:'证件种类',width:100},
{name:'name',label:'姓名',width:100},
{name:"gender",label:'性别',width:50,align:'center',formatter:genderFormatter },
{name:'currentAddress',label:'现居地址',width:150},
{name:"logOut",sortable:false,hidden:true,hidedlg:true,width:100}
],
loadComplete: afterLoad,
multiselect:true,
onSelectRow:selectRow
});
[color=red]jQuery("#overseaPersonnelList").jqGrid('setFrozenColumns');[/color]
[b][color=blue]注:当是多列需要该功能时,需要将这些列放置到一起,需要锁定的列中间不可以有别的不需要锁定列,不然被中断的后续列将不再被锁定。[/color][/b]
[/size]