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_Related Related Topics sp_TopicIcon
postdata in afterComplete, return text, but not the value of the select data element.
16/04/2010
12:07
Avatar
ivanchain
Member
Members
Forum Posts: 55
Member Since:
11/03/2010
sp_UserOfflineSmall Offline

Hi,

Very strange.

I have a editdialog like this:

jQuery("#list1").jqGrid({
     datatype: 'local',
    height:200,
    colNames:['TableID','TypeNeedCheck'],
    colModel :[
      {name:'TableID', index:'TableID', width:55, sorttype:'int', hidden:true,align:'center',classes:"JqGrid"}, 
      {name:'TypeNeedCheck', index:'TypeNeedCheck',edittype:'select',editoptions:{value:{'1':'abc','0':'def'}} ,editrules:{edithidden:true},formoptions:{label:'test it', rowpos:3, colpos:1}, align:'center',hidden:true,editable:true,classes:"JqGrid"}
       ],
  pager: '#pager1',
 scroll: 0,
    rowNum:0,
    viewrecords: true,
    caption: ''
   
  });

it works fine, and I save the data to server like this:

grid.editGridRow(rowKey, width:"750",

                       mtype:"GET",
                       url: "/KPIGetData/AssessSavingData.aspx,
                       afterComplete:function(response, postdata){

                       alert(postdata["TypeNeedCheck"])
                                             
                       },

 )

It works fine at server, when I change the TypeNeedCheck select data element at the editdialog and save, the server side get the select element's value correctly, that is, 1 or 0. But, in the afterComplete, I show the postdata["TypeNeedCheck"], shock me that the result is 'abc' or 'def'!

Why??  It's designed to be so? then how to get the value of the select data element?  In most situation, we need the VALUE , but the demo text.

yours,

Ivan

19/04/2010
13:34
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

This is true and is long to explain. Short - what you deliver to grid from server then this will be posted to it in this event.

It seems like your sever code deliver the value, but not the key.

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.

20/04/2010
17:53
Avatar
ivanchain
Member
Members
Forum Posts: 55
Member Since:
11/03/2010
sp_UserOfflineSmall Offline

hello tony,

but why the sever code deliver the value, but not the key?
I do nothing to deliver in the server code. please notice this ajax is used to save data. In the server code, after saving data, the only thing I do is:

   Response.Clear();
   Response.Write(fact.TableID.ToString());
   Response.End();

the fact.TableID is used in afterComplete as response para, as the demo said, that works fine.

In fact I don't do any thing to control how the server deliver to the grid. So by default, the server will diliver the value(not the key) back to the grid?  If so, How to control the server post KEY to the grid?

yours,
ivan

26/04/2010
12:51
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

In order to be a clear. The data that you return from server to load GRID DATA does not contain the key, but the value.

Hope you understand what I mean now.

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.

26/04/2010
16:25
Avatar
ivanchain
Member
Members
Forum Posts: 55
Member Since:
11/03/2010
sp_UserOfflineSmall Offline

ok.

What I want is to update the grid after the ajax saving.

grid.editGridRow("new", {width:"750",addCaption:"somthing",bSubmit:"save",bCancel:"out",closeAfterAdd:true,
                    
                       mtype:"GET",
                       url: "/KPIGetData/AssessSavingData.aspx",
                      
                       afterComplete:function(response, postdata){

                      // I want to UPDATE the grid to show the new row I just add in this method.  That's why I want to get the KEY, but not the value.

                       ......

Because I found the grid didn't add a new row automatically after the server saving. So it means I need to reload all the data of the grid after I do the add saving?

yours,

ivan

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
45 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