EasyUI Forum

General Category => Bug Report => Topic started by: Stefan B. on November 06, 2014, 08:53:47 AM



Title: bug in edatagrid with combobox editor and using updateUrl
Post by: Stefan B. on November 06, 2014, 08:53:47 AM
We have an edatagrid with textfields and combobox fields.
The combobox is editable.
The combobox entrys use different
Code:
valueField:'id' and textField:'name'

Now if we edit one row with existing combobox entry and don't change the combobox value the 'textField' is sent to the remote server over the updateURL!
This is a error, it should be send the 'valueField' value not the textfield value!

If we change the combobox value the 'valueField' value is send to the server. That's fine!

I Think the editor not init the valueField of the combobox correct.


Here is the table definition code:
Code:
	$('#ed').edatagrid({
pagination: true, fitColumns: false,
//idField: 'idString', //this is not working with filter
sortName: 'waveName',
saveUrl: 'add.do', //to add a new wave
updateUrl: 'edit.do', // to save edit data
url: 'getData.do'
columns:[[
{field:'projectName', title:'<%=lang.get("gbSubProject")%>', width:240, sortable:true,
editor:{
type:'combobox',
options:{
width:'220',
panelWidth:'220',
editable:false,
fitColumns:true,
required:false,
mode: 'local',
valueField:'id',
textField:'name',
url:'getAllGordisEntities.do?eN=Project&oBc=name'
}
}
},
          {field:'description', title: '<%=lang.get("thDesc")%>', width:400, sortable:true,
editor:{
type:'validatebox',
options:{
required:false,
validType:'length[1,256]'
}
}
}
      ]],
onLoadError: function(index) {
consoleDebug('table >> onLoadError!');
}
});



Title: Re: bug in edatagrid with combobox editor and using updateUrl
Post by: jarry on November 06, 2014, 06:51:52 PM
Now if we edit one row with existing combobox entry and don't change the combobox value the 'textField' is sent to the remote server over the updateURL!

What do you mean 'existing combobox entry'? Please explain it in more detail.


Title: Re: bug in edatagrid with combobox editor and using updateUrl
Post by: Stefan B. on November 07, 2014, 12:46:36 AM
OK. I'am add the two screenshots for an example.

1. Screen: shows the original datagrid with data. the datahrid has two columns with combobox editors.
2. Screen: We only change one "textfield" not the combobox data.
3. Then we save the data by using the 'updateUrl' of the edatagrid extension.
4. Now the wron parameter value are post to the controller. The fields 'projectName' and 'projectCoordinator' should have the ID from the 'valueField' of the combobox!

Code:
RequestParameters for URI: /GordisWebClient/editWavePlanning.do
<idString=84C23A6C-797B-4F1A-A5A7-946349649CD1>
<description=xyz>
<projectName=P2V>
<projectCoordinator=Eberding, Heinz>

Its works if we change the combobox entry by selecting a nother row of the combobox. Then the post shows the following:

Code:
RequestParameters for URI: /GordisWebClient/editWavePlanning.do
<idString=84C23A6C-797B-4F1A-A5A7-946349649CD1>
<description=xyz>
<projectName=12>
<projectCoordinator=23>




Title: Re: bug in edatagrid with combobox editor and using updateUrl
Post by: jarry on November 07, 2014, 08:03:05 AM
When the combobox editor is saved, the 'valueField' value will be updated to the current datagrid row. When the row begin editing, the field value of datagrid row will be set to the combobox editor. From your description, the field name 'projectName' does not match the 'valueField' name of combobox.

To solve this issue, you may need to use another field name such as 'projectId' to match the combobox editor, or set the combobox value manually when entering and leaving the editing action.


Title: Re: bug in edatagrid with combobox editor and using updateUrl
Post by: Stefan B. on November 07, 2014, 08:18:39 AM
THX for this answer. Now I understand the problem.  :)