EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: alisanie on October 12, 2014, 10:12:13 PM



Title: edatagrid and post more data when want to save row
Post by: alisanie 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


Title: Re: edatagrid and post more data when want to save row
Post by: jarry 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');
  }
});


Title: Re: edatagrid and post more data when want to save row
Post by: alisanie 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?



Title: Re: edatagrid and post more data when want to save row
Post by: jarry 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'
}
});


Title: Re: edatagrid and post more data when want to save row
Post by: alisanie on October 13, 2014, 12:49:53 AM
No!its not working


Title: Re: edatagrid and post more data when want to save row
Post by: chrwei 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.


Title: Re: edatagrid and post more data when want to save row
Post by: alisanie 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)


Title: Re: edatagrid and post more data when want to save row
Post by: chrwei on October 15, 2014, 07:09:46 AM
jarry's suggestion does exactly that.


Title: Re: edatagrid and post more data when want to save row
Post by: alisanie on October 15, 2014, 07:55:06 AM
OK! I can't post my code because it's really messy right now :D
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.

(http://i57.tinypic.com/2gv7o5c.png)