I have been searching all over internet for a solution to my simple problem (I hope) but unfortunately nothing has helped!..
I am a beginner with jqGrid and I have successfully made it to show all my sample array data in a table.. What I want is to be able to edit the "role" column inline and save it back to the array data... I am using Zend framework and have this issue:
My problems
I am not able to edit the data at all. I can just select and highlight as usual, no textarea is been provided..
Here is my HTML (please verify I am using the right libraries):
<html>
<head>
<title>JqGrid Test</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="/js/jquery-ui-1.8.18.custom/css/ui-lightness/jquery-ui-1.8.18.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/js/jquery.jqGrid-4.4.0/css/ui.jqgrid.css" />
<script src="/js/jquery.jqGrid-4.4.0/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="/js/jquery.jqGrid-4.4.0/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="/js/jquery.jqGrid-4.4.0/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="/js/test/index.js" type="text/javascript"> </script>
<script src="/js/jquery-ui-1.8.18.custom/js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
<script src="/js/jquery.jqGrid-4.4.0/src/grid.loader.js" type="text/javascript"> </script>
</head>
<body>
<table id="list" class="scroll"></table>
<br />
</body>
</html>
Next my index.js
:
$(document).ready(function(){
var lastsel2;
jQuery("#list").jqGrid({
datatype: "local",
height: 250,
colNames:['Role Id','name'],
colModel:[
{name:'id',index:'id', width:60, sorttype:"int", editable: true},
{name:'name',index:'name', width:100, sortable:false,editable: true,
edittype:"textarea", editoptions:{rows:"2",cols:"10" },
],
onSelectRow: function(id){
if(id && id!==lastsel2){
jQuery('#list').restoreRow(lastsel2);
jQuery('#list').editRow(id,true);
lastsel2=id;
}
},
caption: "Manipulating Array Data",
});
var mydata = [
{id:"1",name:"test"},
{id:"2",name:"test2"},
{id:"3",name:"test3"},
{id:"4",name:"test"},
{id:"5",name:"test2"},
{id:"6",name:"test3"},
{id:"7",name:"test"},
{id:"8",name:"test2"},
{id:"9",name:"test3"}
];
for(var i=0;i<=mydata.length;i++)
jQuery("#list").jqGrid('addRowData',i+1,mydata[i]);
});
What am I missing? I hope my question was clear and I thank and appreciate in adv to all who posts a response!