Forum
06:44
23/12/2010
Hello Friends ,
I have developed a grid in jqGrid. In that grid I am having two drop down lists . One is for "voucherLit" and the second for "Denomination List" .
Now , when I click on the edit button , It will open a popup for editing that row . What I want in the edit popup , when I change the value of "Voucher List" , It will call a function and change the values of "Denomination List" .
Here , I am able to call the function , but I can not change the values of drop down box in edit popup.
can anyone help me ?
I have written the code below :
jQuery('#listData').jqGrid({
datatype:"local",
height:150,
colNames:['Voucher Type','Denomination','Booklet Quantity','Booklet Size'],
colModel:[
{name:'voucherType',index:'voucherType',align:'center',sortable:false,editable:true,edittype:"select",editrules:{required:true},
editoptions:{value:getVoucherList().toString(),dataEvents:[{type:'change',
fn:function(e){
alert("value changed");
var parentGrdObject=parent.document.getElementById('listData');
$('#listData').setColProp('denomination',{editoptions:{value:"se:select;gu:gunjan"}});
}
}
]
}
},
{name:'denomination',index:'denomination',align:'center',sortable:false,editable:true,edittype:"select",editoptions:{value:getDenominationList('getInitData').toString()},editrules:{required:true}},
{name:'quantity',index:'quantity',align:'center',sortable:false,editable:true,edittype:"text",editoptions:{size:"4"}, editrules:{number: true,required:true}},
{name:'size',index:'size',editable:true,sortable:false,edittype:"text",align:'center',editoptions:{size:"4"}, editrules:{number: true}}
],
pager: '#pager10',
viewrecords:true,
multiselect:false,
editurl:"jsp/doNothing.jsp",
onSelectRow: function(id){
//This is used for row Editing
$('#selectedRowId').val(id);
}
}).navGrid('#pager10',
{edit:true,add:false,del:false,search:false,refresh:false},
{navkeys:[false,38,40]} //For Edit parameters
).navButtonAdd('#pager10',
{
caption:"Add",
buttonicon:"ui-icon-add",
onClickButton: function()
{
var maxRows = jQuery("#listData tr").length;
maxRows = maxRows - 1;
//Dont allow rows more than denominations
if(maxRows==4){
alert("You can not add more rows");
return false;
}
//Check If are there values on the Previous Row ??
//Here we will check the for the values of last row
var grid = jQuery('#listData');
var val1 = grid.jqGrid('getCell',maxRows,'voucherType');
var val2 = grid.jqGrid('getCell',maxRows,'denomination');
var val3 = grid.jqGrid('getCell',maxRows,'quantity');
if(maxRows>0){
if(val1=="Select"){
alert("Please, Select voucher type in prevoous row ");
return false;
}else if(val2=="Select"){
alert("Please, Select Denomination in prevoous row ");
return false;
}
else if(val3.length==0){
alert("Please, Enter Quantity in prevoous row ");
return false;
}
}
var str=getDenominationList('addOperation').toString();
//alert("value to be added:"+getDenominationList('addOperation').toString()+" and length="+getDenominationList('addOperation').toString().length);
$("#listData").setColProp('denomination',{editoptions:{value:getDenominationList('addOperation').toString()}});
//$("#listData").setColProp('denomination',{editoptions:{value:"1:gunjan;3:gunjan s"}});
var tableData = [{voucherType:"Select",denomination:"Select",quantity:" ",size:" "}];
jQuery("#listData").jqGrid('editGridRow',"new",{reloadAfterSubmit:false,closeAfterAdd:true});
return true;
}
}).navButtonAdd('#pager10',
{
caption:"Delete",
buttonicon:"ui-icon-delete",
onClickButton: function()
{
//get the currently selected row
var toDelete = $("#listData").jqGrid('getGridParam','selrow');
var maxRows=jQuery("#listData tr").length;
//alert("total rows:"+maxRows);
if(toDelete!=null){
if(maxRows>1){
$("#listData").jqGrid(
'delGridRow',
toDelete,
{url:'jsp/doNothing.jsp',reloadAfterSubmit:true}
);
return true;
}
}else{
alert("Please, select a row");
return false;
}
}
});
Thanx in advance
Most Users Ever Online: 715
Currently Online:
35 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