Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
How to insert a row for inline editing ?
30/11/2009
10:43
Avatar
cakebunny
Member
Members
Forum Posts: 3
Member Since:
29/11/2009
sp_UserOfflineSmall Offline

My grid is too long , it needs to scroll to see the full fields , so I don't want to use a popup to let the user fill in the data.

Instead I want to insert a row ,and then for an inline editing .

Is there anyone can give me some ideas ? Thanks.

30/11/2009
12:30
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

15/01/2010
10:54
Avatar
aznan
Member
Members
Forum Posts: 32
Member Since:
14/01/2010
sp_UserOfflineSmall Offline

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.. newbieCry

19/01/2010
11:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

22/01/2010
03:24
Avatar
aznan
Member
Members
Forum Posts: 32
Member Since:
14/01/2010
sp_UserOfflineSmall Offline

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..

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information