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
Issue with SaveRow(); Please help. Will pay!
19/10/2010
02:19
Avatar
jonaofarc
CA
New Member
Members
Forum Posts: 2
Member Since:
19/10/2010
sp_UserOfflineSmall Offline

Whoever gets this gets a beer.

Upon OnSelectRow, Iam trying to produce an alert from the callback function hello once saved, what am I doing wrong.(script below)

It may be that Iam a little confused as to how to use the save row API method.

Heres what I have:

jQuery("#rowed3").jqGrid('saveRow',id, hello, url, rowList, hello,hello, hello);

My Questions:

A) Do I have to have all the parameters in the saveRow method for the function to work?

B) Where does the hello(); function have to be located for it to work?

C) How can I see the ajax data being sent to the server? Meaning upon using the SaveRow function what array or data is being sent to server?

D) How to I properly use SaveRow in my script , Iam trying to get an alert() to set off within the hello function once the function SaveRow has been executed.

My Script:

$(document).ready(function() {
var lastsel;
function hello() {
    
alert("Done");    
    
}
jQuery("#rowed3").jqGrid({
       url:'http://charmednetworks.com/gri.....p',
    datatype: "json",
       colNames:['Actions','Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
       colModel:[
        {name:'act',index:'act', width:75,sortable:false},
           {name:'id',index:'id', width:90},
           {name:'invdate',index:'invdate', width:120, editable:true},
           {name:'name',index:'name', width:100,editable:true},
           {name:'amount',index:'amount', width:80, align:"right",editable:true},
           {name:'tax',index:'tax', width:80, align:"right",editable:true},        
           {name:'total',index:'total', width:80,align:"right",editable:true},        
           {name:'note',index:'note', width:120, sortable:false,editable:true}        
       ],
       rowNum:10,
       rowList:[10,20,30],
       pager: '#prowed3',
       sortname: 'id',
    viewrecords: true,
    sortorder: "desc",
    onSelectRow: function(id){
        if(id && id!==lastsel){
            jQuery('#rowed3').jqGrid('restoreRow',lastsel);
            jQuery('#rowed3').jqGrid('editRow',id,true);
            jQuery("#rowed3").jqGrid('saveRow',id, hello, url, rowList, hello,hello, hello);
            lastsel=id;
            alert(id);
        }
    },
    gridComplete: function(){
        var ids = jQuery("#rowed3").jqGrid('getDataIDs');
        
        for(var i=0;i < ids.length;i++){
            var cl = ids[i];
            be = "<input style='height:22px;width:20px;' type='button' value='E' onclick="jQuery('#rowed3').editRow('"+cl+"');" >";
            se = "<input style='height:22px;width:20px;' type='button' value='S' onclick="jQuery('#rowed3').saveRow('"+cl+"');"  >";
            ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick="jQuery('#rowed3').restoreRow('"+cl+"');" >";
            jQuery("#rowed3").jqGrid('setRowData',ids[i],{act:be+se+ce});
        }    
    },
    editurl: "http://charmednetworks.com/grid_project/myproject/json/json.php",
    caption: "Problems",
    toolbar: [true,"top"]
      
});
jQuery("#rowed3").jqGrid('navGrid',"#prowed3",{edit:false,add:false,del:false});

$("#t_rowed3").append("<input type='button' value='Add Row' style='height:40px;font-size:-3;'/>"); $("input","#t_rowed3").click(
    function(id){
        var datarow = { id:"",
                        invdate:"",
                        name:"",
                        amount:"",
                        tax:"",
                        total:"",
                        note:""};
                           var lastsel2 = id;
                        var su= jQuery("#rowed3").addRowData(4, datarow, "first") ;
                        alert(su);
                  if (su) {        
                         var edit = jQuery('#rowed3').editRow(4,true,'http://charmednetworks.com/grid_project/myproject/json/json.php&#39;);                            
                          if(su) {
                              alert();
                              }
                          }
        //jQuery("#rowed3").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false});
    });
});

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