当前位置: 代码迷 >> Web前端 >> JQGrid极限有关问题
  详细解决方案

JQGrid极限有关问题

热度:341   发布时间:2012-06-29 15:48:46.0
JQGrid极限问题
var monthcode=$('#year option:selected').val()+'-'+$('#month option:selected').val()+'-01';
	var staff_parent_code=$('#month_sr option:selected').val();
	var month_dsr=$('#month_dsr option:selected').val();
	if($.trim(staff_parent_code)!='')
	{
		jQuery("#list").GridUnload();
		jqGridAdapter("#list");
		var mygrid = jQuery("#list").jqGrid({
			url: '../ListServlet?className=monthlyTask&type=itembase&info=loadList&monthcode=' + monthcode + '&parentcode=' + staff_parent_code+'&month_dsr='+month_dsr,
			datatype: "json",
			colNames: ['代码', '名称', '职务', '业务类型', 'HPC网点数', '销量', 'ECO', '完美门店', '分销单品', 'FOODS网点数', '销量', 'ECO'],
			colModel: [{
				name: 'STAFF_CODE',
				index: 'STAFF_CODE',
				width: 18,
				align: 'left'
			}, {
				name: 'STAFF_NAME',
				index: 'STAFF_NAME',
				width: 18,
				align: 'left'
			}, {
				name: 'STAFF_POSITION_NAME',
				index: 'STAFF_POSITION_NAME',
				width: 18,
				align: 'left'
			}, {
				name: 'COMPANY',
				index: 'COMPANY',
				width: 18,
				align: 'left'
			}, {
				name: 'HPC_COUNT',
				index: 'HPC_COUNT',
				width: 18,
				align: 'left'
			}, {
				name: 'SALESTARGET_H',
				index: 'SALESTARGET_H',
				width: 18,
				editable:true,
				editrules:{number:true},
				align: 'left'
			}, {
				name: 'ECOTARGET_H',
				index: 'ECOTARGET_H',
				width: 18,
				editable:true,
				editrules:{number:true},
				align: 'left'
			}, {
				name: 'PERFECT_TARGET',
				index: 'PERFECT_TARGET',
				width: 18,
				align: 'left'
			}, {
				name: 'SINGLE_TARGET',
				index: 'SINGLE_TARGET',
				width: 18,
				align: 'left'
			}, {
				name: 'FOODS_COUNT',
				index: 'FOODS_COUNT',
				width: 18,
				align: 'left'
			}, {
				name: 'SALESTARGET_F',
				index: 'SALESTARGET_F',
				editable:true,
				editrules:{number:true},
				width: 18,
				align: 'left'
			}, {
				name: 'ECOTARGET_F',
				index: 'ECOTARGET_F',
				width: 18,
				editable:true,
				editrules:{number:true},
				align: 'left'
			}],
			rowNum: 15,
			rowList: [15, 25, 30, 50, 100],
			pager: '#pager',
			sortname: 'staff_code',
			viewrecords: true,
			sortable: true,
			autowidth: true,
			cellEdit: true,
			sortorder: "asc",
			caption: "任务汇总",
			multiselect: false,
			rownumbers: true,
			rownumWidth: 18,
			jsonReader: {
				repeatitems: false
			},
			height: 'auto',
			 gridComplete:function()
			 {
			 	 var ids=jQuery("#list").jqGrid('getDataIDs');
				  for (var i = 0; i < ids.length; i++) {
				  	var id = ids[i];
				  	var position=jQuery("#list").jqGrid('getRowData', id).STAFF_POSITION_NAME;
				  		if (position == 'RKDSR') {
							/*
jQuery("#list").jqGrid('setGridParam', {
								cellEdit: false
							});
							
*/
						}
				  }
			 }
		});
		
		jQuery("#list").jqGrid('setGroupHeaders', {
  		useColSpanStyle: false, 
 		 groupHeaders:[
		{startColumnName: 'STAFF_CODE', numberOfColumns: 4, titleText: '<b>DSR</b>'},
		{startColumnName: 'HPC_COUNT', numberOfColumns: 5, titleText: '<b>HPC目标</b>'},
		{startColumnName: 'FOODS_COUNT', numberOfColumns: 3, titleText: '<b>FOODS目标</b>'}
  ]	
});
	}
	else{
		alert('请选择SR!');
	}




现在就有一个问题,想让职位为RKDSR列中的销量不可以编辑ECO可以编辑,其它的列销量和ECO都可以编辑,求指点下?