Welcome Guest, Not a member yet? Register   Sign In
jqgrid - help with update
#1

[eluser]Unknown[/eluser]
i have jqgrid displaying a grid of data and i have the form edit options enabled.
i have the editurl parameter specified in the script.
i am unsure of how to proceed with the coding of the controlled method to actually perform the update. Is there a controller method as well as a javascript function that needs to be written.

This is the script I have in a view...

[removed]
$(function() {
$("#list").jqGrid({
url:'example1',
editurl:'example1edit',
datatype: 'xml',
mtype: 'POST',
colNames:['Trans Code', 'Price', 'Proc Code', 'Md 1'],
colModel :[
{name:'trans_code', index: 'trans_code', width:80},
{name:'trans_price', index: 'trans_price', width:80, align:'right', formatter:'number'},
{name:'trans_hcspcs', index: 'trans_hcspcs'},
{name:'trans_hcspcs_md1', index: 'trans_hcspcs_md1', width:50, editable:true}
],
width: 600, // width in pixels
pager: '#pager',
rowNum: 10,
rowList: [10,20,30],
sortname: 'trans_code',
sortorder: 'desc',
viewrecords: true,
gridview: true,
caption: 'Transactions'
});
jQuery("#list").jqGrid('navGrid','#pager',{
edit:true,
add:false,
del:false,
search:false,
refresh:true});

});
[removed]

and this is the method I am trying to get going to perform the update...
I know it is incomplete, but I do not see this getting executed at all...
//------------------------------------------------------------------------------------------
function example1edit() {
print_r($_POST);
echo 'in example1edit!!!!!';

$q = "update trans_visit set trans_hcspcs_md1 = '99' where provider_code = ? and account_number = ?";
$params = array('JHPHY', '48074');
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$x = sqlsrv_query($db, $q, $params, $options);
if ($x === false)
{
echo "Error in query preparation/execution (example1editSmile.\n";
die( print_r( sqlsrv_errors(), true));
}

if($_GET['oper']=='add')
{
//... ... ...
}
//if($_GET['oper']=='edit')
if ($this->input->post['oper']=='edit')
{
print_r($_POST);
//... ... ...
}
if($_GET['oper']=='del')
{
//... ... ...
}



} // end example1edit


any comments would sure be appreciated!!




Theme © iAndrew 2016 - Forum software by © MyBB