我想知道它是否可能为每行(或某些)行使用不同的背景颜色。
我还有另一个问题,我已经定义了我只想在添加时设置的复选框,但是当网格显示所有行时我不想看到它。这可能吗?
这是我的代码..
$("#<%=Me.Id & "_" %>lstBaseHab").jqGrid({
url: '/modulos/tarifa/basehabitacion.ashx',
datatype: 'xml',
mtype: 'GET',
colNames: ['Hab ID','Habitación','Importe', 'Fecha Inicio','Fecha Fin','Noches Estancia/Mínimas','Todos','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado','Domingo','tarId', 'estId'],
colModel: [
{ name: 'hab_id', index: 'hab_id', width: 100, align: 'center', editable: false, sortable: false, hidden: true},
{name: 'hab_nombre', index: 'hab_nombre', width: 200, align: 'center', edittype: 'select', editable: true, sortable: false, editrules: { edithidden: false, required: true }
, editoptions: { size: 1, dataUrl: '/modulos/tarifa/basehabitacion.ashx?oper=listahabs' }
},
{ name: 'tpb_importe', index: 'tpb_importe', width: 160, align: 'center', editable: true, sortable: true },
{ name: 'fini', index: 'fini', width: 300, align: 'center', editable: true, editoptions: { dataInit: function(el) { setTimeout(function() { $(el).datepicker({ dateFormat: 'dd/mm/yy' }); }, 200); } }, editrules: { edithidden: false }, sortable: true },
{ name: 'ffin', index: 'ffin', width: 300, align: 'center', editable: true, editoptions: { dataInit: function(el) { setTimeout(function() { $(el).datepicker({ dateFormat: 'dd/mm/yy' }); }, 200); } }, editrules: { edithidden: false }, sortable: true },
{ name: 'Nochesestancia', index: 'Nochesestancia', width: 300, align: 'center', sortable: false, editable: true },
{ name: 'Lun', index: 'lun', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "1:" }, editrules: { edithidden: false }, sortable: false },
{ name: 'Mar', index: 'mar', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "2:" }, editrules: { edithidden: false }, sortable: false },
{ name: 'Mie', index: 'mie', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "3:" }, editrules: { edithidden: false }, sortable: false },
{ name: 'Jue', index: 'jue', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "4:" }, editrules: { edithidden: false }, sortable: false },
{ name: 'Vie', index: 'vie', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "5:" }, editrules: { edithidden: false }, sortable: false },
{ name: 'Sab', index: 'sab', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "6:" }, editrules: { edithidden: false }, sortable: false },
{ name: 'Dom', index: 'dom', width: 50, formatter: "checkbox", align: 'center', editable: true, hidden: true, edittype: "checkbox", editoptions: { value: "0:" }, editrules: { edithidden: false }, sortable: false }
],
ajaxSelectOptions: {
data: {
estId: function () { return __estId; }
}
},
ajaxGridOptions: {cache: false},
autoencode: false,
toppager: false,
loadonce:false,
pager: '#preciobasepager',
rowNum: 40,
rowList: [20, 40, 80, 100, 200, 500, 1000],
sortname: 'fini',
sortorder: 'asc',
autowidth: false,
width: 850,
height: -1,
shrinkToFit: true,
viewrecords: true,
gridview: true,
prmNames: {oper:"listarbaseshabitacion", addoper:"crearbasehabita", deloper:"borrabasehabita"},
caption: 'Precios base para habitaciones'
, editurl: '/modulos/tarifa/basehabitacion.ashx'
, postData: {
tarId: function ftar(){return __tarId;},
estId: function fest(){return __estId;}
}, afterSaveCell : function(rowid,name,val,iRow,iCol) { }
, loadComplete: function() { }
, onCellSelect: function(rowid, index, contents, event) {
<%=Me.id %>_selectedRow=jQuery(this).getRowData(rowid);
}
});
jQuery("#<%=Me.Id & "_" %>lstBaseHab").jqGrid('navGrid',
'#preciobasepager',
{ alerttext: "Seleccione un registro.",
add: true, addtitle: "Crear precio base", //addfunc: newPrecioBase,
del: true, deltitle: "Eliminar precio base", // delfunc: delPrecioBase,
edit: false, edittitle: "Editar precio base",
search: false, searchtitle: "Buscar",
refresh: true,
cloneToTop: true
},
{ width: 350, resize: false, closeAfterEdit: true, recreateForm: true, viewPagerButtons: true, afterComplete: null },
{ width: 350, resize: false, closeAfterAdd: true, recreateForm: true, viewPagerButtons: true, afterComplete: null },
{ width: 350, resize: false, msg: "¿Desea eliminar la relación?", afterComplete: null }
);
如果我把它的隐藏显示hidden:true
(如在colModel
谢谢。