Forum
Topic RSS
08:50
14/01/2010
Offlinei hv an issue here…I'm creating a system which record claim for our staff. and thing works ok if theres no new record/claim being made… (which is NOT possible accept my company is closed) FYI i'm integrating the system by using jqgrid inside FACEBOX.
first thing first:
I hv 2 tables for data :
a) tbl_claim ~ data for claim e.g. name, date. [enter] it will generate "claim id"
b) tbl_claimdetail ~ Detail claim e.g. list of item claimed, amount, generate "detail claim id"
i hv these files
1. claim.php – (contain form + div & table for jqgrid, + attach the claimgrid.js)
2.claimgrid.js – (contain the jqgrid properties)
3.claimdata.php – (for populating data inside jqgrid)
4.claimedit.php – (for update and insert data inside jqgrid)
5.claimid.php – (for inserting data inside 'tbl_claim')
I dont have problem when it involve adding data inside existing record i.e. I already have a claim record inside the"tbl_claim" and i only add data inside the grid into the "tbl_claimdetail".
But problem arise when I add new claim data…when user login to the system they will be given a form (claim.php) to keyin their detail e.g. name (from login session), date of claim, purpose etc. when the user submit the form and new record is being created (inside tbl_claim), I extract the "claim_id" through ajax success function. this data will be send to the custom button navButton as "ap_id" (FYI there are 2 ap_id inside 'claimgrid.js' I did try different name but nothing change).. and the value is inserted inside row through addRowData.. before editRow being called.. I managed to key in all data.. and when [enter] data is submitted to database.
BUUTT the grid is still in edit mode, and the row is not restored (I managed to get the row restored but the data is not there – the ROW is empty). and when I ADD another record the data is not send to the database..stuck inside the edit mode. so thats my problem I cant update the grid with the new data. and somehow the edit/add process is not working properly..
and now I'm in a BIG MESSz!!!
below and the code inside the jqgrid.js … S.O.S
helppppp…. anyone…. tony?
Button and other function:
jQuery("#claim").jqGrid('navButtonAdd','#pagerclaim',{caption:"New", buttonicon :'ui-icon-circle-plus',
onClickButton:function(id){
jQuery('#claim').restoreRow(lastSel);
var ap_id = $("#no").val(); //grab id from the ajax succes function
var datarow = {int_claimid:ap_id};
jQuery("#claim").addRowData("0",datarow,"first");
jQuery('#claim').editRow("0", true, pickdates, refresh);
lastSel = id;
},
title:"New Record",
position:"last"
});
function pickdates(id){
jQuery("#"+id+"_dt_date","#claim").datepicker({dateFormat:"dd-mm-yy"}); }
function refresh(id){
jQuery('#claim').trigger("reloadGrid");
}
Main Grid Data:
jQuery(document).ready(function(){
var lastSel;
var ap_id = $("#no").val();
jQuery("#claim").jqGrid({
url:'form/claim_data.php?apid='+ap_id,
datatype: "json",
colNames:['Claim Detail ID','Item','Claim ID', 'Date', 'Reference', 'Amount', 'Site ID','Acc ID'],
colModel:[
{name:'int_claimdetailid',index:'int_claimdetailid', align:"center", width:110, hidden:true },
{name:'txt_item', index:'txt_item', editable:true, align:"center", width:150, stype:'text' },
{name:'int_claimid',index:'int_claimid asc, txt_item', editable:true, align:"center", width:50},
{name:'dt_date',index:'dt_date', width:80, align:"center", editable:true,formatter:'date', editoptions:{dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});} }/*, formatoptions:{ rowpos:3, elmsuffix:" * yyyy-mm-dd" }*/ },
{name:'int_reference',index:'int_reference', width:60, align:"center", editable: true, editoptions:{size:"20",maxlength:"30"}},
{name:'cur_amount',index:'cur_amount', width:110, align:"right",editable: true, formatter:'currency', formatoptions:{decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "RM ", suffix: " "}},
{name:'int_siteid',index:'int_siteid', width:50, align:"center", editable: true, edittype:"select", editoptions:{value:{1:'1',2:'2',3:'3'}} },
{name:'int_accid',index:'int_accid', width:50, align:"center", editable: true, sortable:false }
],
pager: '#pagerclaim',
rowNum:10,
rowList:[10,20,30],
height:'100%',
sortname: 'int_claimdetailid',
sortorder: 'desc',
viewrecords: true,
editurl:"form/claim_edit.php",
loadtext: "tgh load tuk, jap lok…",
footerrow:true,
userDataOnFooter : true,
onSelectRow : function(id){
if(id != null) {
if(id == lastSel) {
jQuery('#claim').restoreRow(lastSel);
lastSel=id;
} else {
jQuery('#claim').restoreRow(lastSel);
lastSel=id;
alert ("slctelse LstSel: "+lastSel+" ID: "+id);
jQuery('#claim').editRow(id, true, pickdates, refresh);
}
}}
});
});
[Image Can Not Be Found]
[Image Can Not Be Found]
11:51
14/01/2010
Offlinejust to add someinfo.. it seem the jqgrid unable to refresh grid content…
as u can see if theres data exist.. my "ap_id" have value.. which will then pass to the "url" to populate the grid.
but I hv to get the "ap_id" externally from ajax call (success function) when a button is click. if theres no data exist/new record. only than I can send it to the navAddButton to add the data. i can send the first array of data BUT then mygrid is not 'refresh' with the submitted data.. and later I cant even send data anymore!!!!!
HEEEEEEEEELLLLLLLLLLLLLLPPPPPPPPPPPPPPPP !!!
~newbie
Most Users Ever Online: 994
Currently Online:
44 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
Log In
Home