Forum


12:30

Moderators
30/10/2007

Hello,
Use addRowData and edit that row with editRow.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
10:54

14/01/2010

I try to create a button to do the add new row function by using inline editing..(i think).. but i cant seem to use the enter key watsoeva to send the datas to the db.. plus the datepicker can only accept current date...unless i type it in manually. i dunno how to put/write the url inside the editRow. here my code:
jQuery("#list").jqGrid('navButtonAdd','#pager',{caption:"New", buttonicon :'ui-icon-circle-plus',
onClickButton:function(id){
var datarow = {int_claimdetailid:"",txt_item:"",int_claimid:"",dt_date:"",int_reference:"",
cur_amount:"",int_siteid:"",int_accid:""};
var lastsel2 = id;
var su=jQuery("#list").addRowData(lastsel2, datarow, "first") ;
if (su) {
jQuery('#list').editRow(lastsel2,true,{url: 'jqgrid/new_claimdetail.php'});
alert ("Hi");
}
},
title:"New Button",
position:"last"
});
2. 2nd question.. (will post this under datepicker topic later). I managed to insert the datepicker inside my inline row editing.. but after selecting the date.. how can i set the focus of cursor to the date field so i can use the enter key to send the data... currently i have to do it manually by clicking inside any of the active edited field..
HELLPPP...pleaseeee
tq.. newbie
11:09

Moderators
30/10/2007

Helllo,
For the first issue use this:
jQuery('#list').editRow(lastsel2,true, 'jqgrid/new_claimdetail.php');
2. Could not help if no code. Try first to use datepicke without any options
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
03:24

14/01/2010

well, thanx,… but nothing change… i still cant submit the data by using the enter key.. and all the other cell cant be edited once i press the enter key inside the cell in the new row.. FYI all other function works ok.. read data .. and works well with the predefined add, edit, delete, view… but i wish to do it by inserting the new row.. and then save the data just like the inline editing process..
i gave u the full code… hope u could help..thanx
<script type=”text/javascript”>
jQuery(document).ready(function(){
var lastSel;
jQuery(”#list”).jqGrid({
url:'jqgrid/data_claimdetail.php',
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, sortable:true},
{name:'txt_item',index:'txt_item', editable:true, align:"center", width:150, stype:'text' },
{name:'int_claimid',index:'int_claimid asc, txt_item', 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'});} }, formoptions:{ rowpos:2, 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:80, align:"right",editable: true, formatter:'currency', formatoptions:{decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "RM "}},
{name:'int_siteid',index:'int_siteid', width:50, align:"center", editable: true,edittype:"checkbox",editoptions: {value:"1:2:3"}},
{name:'int_accid',index:'int_accid', width:50, align:"center", sortable:false }
],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
height:250,
sortname: 'int_claimdetailid',
sortorder: 'desc',
viewrecords: true,
editurl:'jqgrid/ins_claimdetail.php',
ondblClickRow: function(id){
if(id && id!==lastSel){
jQuery('#list').restoreRow(lastSel);
lastSel=id;
}
jQuery('#list').editRow(id, true, pickdates);
},
onSelectRow: function(id){
if(id && id!==lastSel){
jQuery('#list').restoreRow(lastSel);
lastSel=id;
}
},
/* afterInsertRow: function(id){
if(id && id!==lastSel){
jQuery('#list').saveRow(id,true,'jqgrid/new_claimdetail.php');
}
}*/
}); /* end of jqgrid */
jQuery(”#list”).jqGrid('navGrid','#pager',{view:true, del:true, edit:true, search:false},
{url: 'jqgrid/ins_claimdetail.php'}, // use default settings for edit
{url: 'jqgrid/new_claimdetail.php'}, // use default settings for add
{url: 'jqgrid/del_claimdetail.php'}, // delete instead that del:false we need this
/*{multipleSearch : true}, // enable the advanced searching*/
{closeOnEscape:true} /* allow the view dialog to be closed when user press ESC key*/
) ;
jQuery(”#list”).jqGrid('navButtonAdd','#pager',{caption:”New”, buttonicon :'ui-icon-circle-plus',
onClickButton:function(id){
var datarow = {int_claimdetailid:””,txt_item:””,int_claimid:””,dt_date:””,int_reference:””,
cur_amount:””,int_siteid:””,int_accid:””};
var lastsel2 = id;
var su=jQuery(”#list”).addRowData(lastsel2, datarow, “first”) ;
if (su) {
jQuery('#list').editRow(lastsel2,true, 'jqgrid/new_claimdetail.php');
alert (”Hi”);
}
},
title:”New Button”, /*tooltip for the button*/
position:”last”
});
function pickdates(id){
jQuery(”#”+id+”_dt_date”,”#list”).datepicker({dateFormat:”yy-mm-dd”}); }
}); /*end of document ready*/
</script>
<table id=”list”></table>
<div id=”pager”></div>
p/s: and hope u could give some thought on the datepicker too! thanx..
Most Users Ever Online: 715
Currently Online:
57 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