EasyUI Forum
May 04, 2024, 03:49:44 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: edatagrid and post more data when want to save row  (Read 12414 times)
alisanie
Newbie
*
Posts: 7


View Profile
« on: October 12, 2014, 10:12:13 PM »

Hi
Im using  and I have two combox box on my page that shoud send their values when want to save data.
When I used save url its just post row value. So is there any chance that I can also post my combo box values too.
TanQ
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: October 13, 2014, 12:16:02 AM »

Before saving a datagrid row, the 'onEndEdit' event will be triggered, in which you can modify the row data that will be posted to server.
Code:
$('#dg').datagrid({
  onEndEdit: function(index,row){
    row.c1 = $('#c1').combobox('getValue');
    row.c2 = $('#c2').combobox('getValue');
  }
});
Logged
alisanie
Newbie
*
Posts: 7


View Profile
« Reply #2 on: October 13, 2014, 12:20:33 AM »

Thank you for your replay.When I want to insert a new record I need to pass combo box values !Any suggestion?

Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: October 13, 2014, 12:27:16 AM »

Please try this:
Code:
// insert a row with default values
$('#dg').edatagrid('addRow',{
index: 2,
row:{
name:'name1',
addr:'addr1'
}
});
Logged
alisanie
Newbie
*
Posts: 7


View Profile
« Reply #4 on: October 13, 2014, 12:49:53 AM »

No!its not working
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #5 on: October 13, 2014, 01:06:55 PM »

both of these solutions do something like what you've described.  one updates the row data by adding to new fields, the other adds a new row to the grid.  both effectively "save data", but since "save data" is concept you invented instead of an actual function, we're only left to guess what you actually want. 

You'll need to be more clear, and if possible post some code showing what you have, what you tried, and show why it's "not working" and if you can, show what it would look like if it were working.
Logged
alisanie
Newbie
*
Posts: 7


View Profile
« Reply #6 on: October 15, 2014, 07:06:56 AM »

Ok.Let me simplified my question.Imagain when I press save button I want to post more parameter.(not only gried field name)
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #7 on: October 15, 2014, 07:09:46 AM »

jarry's suggestion does exactly that.
Logged
alisanie
Newbie
*
Posts: 7


View Profile
« Reply #8 on: October 15, 2014, 07:55:06 AM »

OK! I can't post my code because it's really messy right now Cheesy
As you can see in the picture I have two combo box! When I press save I want to POST my Combo box values with my field parameter to saveurl too.

« Last Edit: October 15, 2014, 07:58:05 AM by alisanie » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!