Forum


04:31

Hello
I'm trying to make an editable grid. Can somebody tell me please why doesn't this work:
<head>
<link rel="stylesheet" type="text/css" href="ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" href="jquery-ui-1.7.1.custom.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery-ui.js"></script>
<script type="text/javascript" src="grid.locale-en.js"></script>
<script type="text/javascript" src="jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="grid.celledit.js"></script>
<title>jqGrid</title>
</head>
<body>
<script type="text/javascript">
$(document).ready
( function()
{ var grid = $("#jqgrid_0").jqGrid
( { datatype: "clientSide",
colNames: ["Inv No", "Date", "Amount", "Tax", "Total", "Notes"],
colModel:
[ {name:0, index:1, width:100, editable:true},
{name:1, index:2, width:100, editable:true},
{name:2, index:3, width:100, editable:true},
{name:3, index:4, width:100, editable:true},
{name:4, index:5, width:100, editable:true},
{name:5, index:6, width:100, editable:true}
],
rowNum: 10,
viewrecords: true,
caption: "My first grid",
pager: $('#jqgrid_pager_0'),
editurl: "http://google.com",
cellEdit: true
}
);
grid.addRowData(1, [1,"2007-10-01","200.00","10.00","210.00","note"]);
grid.addRowData(2, [2,"2007-10-01","200.00","10.00","210.00","note"]);
grid.addRowData(3, [3,"2007-10-01","200.00","10.00","210.00","note"]);
grid.addRowData(4, [4,"2007-10-01","200.00","10.00","210.00","note"]);
grid.addRowData(5, [5,"2007-10-01","200.00","10.00","210.00","note"]);
}
);
</script>
<table id="jqgrid_0" class="scroll"></table>
<div id="jqgrid_pager_0" class="scroll"></div>
<button onclick="$('#jqgrid_0').editCell(3,3)">edit</button>
</body>
</html>
02:23

Moderators
30/10/2007

Hello,
Check first the docs how to use the addRowData 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.
04:51

Hi, tony. Thanks for your remark.
I checked this. addRowData can get 2 arguments:
1) ID of the row
2) Row data as {column_name_0 : value_0, column_name_1 : value_1}
In my case row data is {0:1, 1:"2007-10-01", 2:"200.00", 3:"10.00", 4:"210.00", 5:"note"}
I used the short form of this: [1,"2007-10-01","200.00","10.00","210.00","note"]
addRowData works fine, i see the grid with valid data in it. The problem is that i can't make a cell editable.
Most Users Ever Online: 715
Currently Online:
83 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