This question already has an answer here:
- Way to make jqGrid responsive on web browsers 4 answers
Corrected Code :
<script>
var $grid = $("#list2");
emptyMsgDiv = $("<div><span style='color:red; text-align:center;font-size:18px;display:block;'>No Workorder Found</span></div>");
jQuery("#list2").jqGrid({
url:'server.php',
datatype: "json",
mtype: 'POST',
colNames:['WO#','Status','Customer Name','Salesman', 'Created Date', 'WO Total', 'Notes', 'Edit'],
colModel:[
{name:'id',index:'id', align:"center"},
{name:'status1',index:'status1', align:"center", width:100},
{name:'status2',index:'status2', align:"center", width:50},
{name:'status3',index:'status3', align:"center"},
{name:'result',index:'result', align:"center", sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager2',
sortname: 'Invoice.id',
viewrecords: true,
height:'100%',
autowidth:true,
sortorder: "desc",
height: '100%',
loadComplete: function() {
var ts = this;
if (ts.p.reccount === 0) {
$(this).hide();
emptyMsgDiv.show();
} else {
$(this).show();
emptyMsgDiv.hide();
}
}
});
emptyMsgDiv.insertAfter($grid.parent());
</script>
Here is the code I have for my JqGrid :
<script>
var $grid = $("#list2");
emptyMsgDiv = $("<div><span style='color:red; text-align:center;font-size:18px;display:block;'>No Workorder Found</span></div>");
jQuery("#list2").jqGrid({
url:'server.php',
datatype: "json",
mtype: 'POST',
colNames:['WO#','Status','Customer Name','Salesman', 'Created Date', 'WO Total', 'Notes', 'Edit'],
colModel:[
{name:'id',index:'id', align:"center"},
{name:'status1',index:'status1', align:"center"},
{name:'status2',index:'status2', align:"center"},
{name:'status3',index:'status3', align:"center"},
{name:'result',index:'result', align:"center", sortable:false}
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager2',
sortname: 'Invoice.id',
viewrecords: true,
height:'100%',
sortorder: "desc",
height: '100%',
loadComplete: function() {
var ts = this;
if (ts.p.reccount === 0) {
$(this).hide();
emptyMsgDiv.show();
} else {
$(this).show();
emptyMsgDiv.hide();
}
}
});
emptyMsgDiv.insertAfter($grid.parent());
</script>
I am trying to make the colModel fluid width for the page, I am able to change the width manually for each of the columns as in the following tidbit :
{name:'status1',index:'status1', align:"center", width:50}
However, I can not define percentages, or seem to figure out how to do fluid width. Does anyone have any ideas?