Forum
01:03
10/04/2014
Image put in row selector column is visible if "$('#list4').jqGrid('setFrozenColumns');" is not executed.
How to make image visible when "$('#list4').jqGrid('setFrozenColumns');" is executed.
Thanks,
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>p12page.htm</title>
<script src="jq_Scripts/jquery-ui-1.10.3/js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="jq_Scripts/jqGrid-4.5.4/js/jquery.jqGrid.src.js" type="text/javascript"></script>
<link href="jq_Scripts/jquery-ui-1.8.13/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="jq_Scripts/jqGrid-4.5.4/css/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/jscript">
var lastsel2;
function init0() {
jQuery("#list4").jqGrid({ datatype: "local", height: 150, width: 500, shrinkToFit: false, autowidth: false,
colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [{ name: 'id', index: 'id', width: 60, sorttype: "int", frozen: true },
{ name: 'invdate', index: 'invdate', width: 90, sorttype: "date" },
{ name: 'name', index: 'name', width: 100 },
{ name: 'amount', index: 'amount', width: 80, align: "right", sorttype: "float" },
{ name: 'tax', index: 'tax', width: 80, align: "right", sorttype: "float" },
{ name: 'total', index: 'total', width: 80, align: "right", sorttype: "float" },
{ name: 'note', index: 'note', width: 150, sortable: false}],
multiselect: true, caption: "Manipulating Array Data"
});
var mydata = [{ id: "1", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
{ id: "2", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
{ id: "3", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
{ id: "4", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
{ id: "5", invdate: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
{ id: "6", invdate: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
{ id: "7", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
{ id: "8", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
{ id: "9", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00"}];
for (var i = 0; i <= mydata.length; i++)
jQuery("#list4").jqGrid('addRowData', i + 1, mydata[i]);
//$('#list4').jqGrid('setFrozenColumns'); /* UNCOMMENT OUT this line, image save.gif will not display! */
}
function updt() {
var seld = $('#list4').jqGrid('getGridParam', 'selarrrow'); if (seld.length == 0) { alert('Please select a row!'); return; }
var selector = $('#list4').find('#' + seld[0] + ' input[type=checkbox]')[0];
if (typeof selector != 'undefined' && selector.parentElement.cellIndex == 0) {
selector.outerHTML = "<img src='images/save.gif' class='cbox' title='Save changes!'>";
}
}
</script>
</head>
<body onload="init0()">
<table id="list4"></table>
<input type="button" value='Update' onclick="updt()" />
</body>
</html>
12:45
Moderators
30/10/2007
Hello,
Before to put image you will need to destroy the forzen column (there is a method for this - just look into the docs) and after set the image call again the setFrozen columns method.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
18:48
10/04/2014
14:59
Moderators
30/10/2007
Hello,
Glad to help.
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
30 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66