views:

263

answers:

1

The buttons I have added to the rows still post back even if I specifiy not to do so in the onclick method of the button (onclick=' return false;'). I supose its the grid doing the post back? I am tring to prevent the postback and show my own custom popup forms.

gridComplete: function(){ 
 var ids = $('#jqGridControl1').jqGrid('getDataIDs'); 
 for(var i=0;i < ids.length;i++){ 
 var rowid = ids[i]; 
 de = "<input type='image' title='Delete this record.' src='../images/icn_delete.gif' onclick=' return false;' style='border-width:0px;'/>"; 
 ee = "<input type='image' title='Edit this record.' src='../images/icn_edit.gif' onclick=' return false;' style='border-width:0px;' />"; 
 ve = "<input type='image' title='View related information.' src='../images/house.gif' onclick='return false;' style='border-width:0px;' />"; 
 pe = "<input type='image' title='Print' src='../images/icn_printer.gif' onclick=' return false;' style='border-width:0px;' />"; 
 je = "<input type='image' title='Appointment' src='../images/icn_journal.gif' onclick=' return false;' style='border-width:0px;' />"; 
 se = "<input type='image' title='Select' src='../images/icn_select.gif' onclick=' return false;' style='border-width:0px;' />"; 
 jQuery('#jqGridControl1').jqGrid('setRowData',ids[i],{act:de+ee+ve+pe+je+se}); 
 } 
A: 

After some more work on this I figured out that it worked in FF and Safari. The issue was IE. Instead of just onclick='return false;' I changed it to onclick='event.returnValue=false; return false;' and that worked. Not sure why that is. If I have the input tag written in HTML with onclick='return false;' it works fine. Not sure why its different when the lines are generated on the fly at the client.

snyder