|
#1
|
|||
|
|||
|
Hello,
In SmartClient Version: SC_SNAPSHOT-2011-11-08/PowerEdition Deployment (built 2011-11-08). When updating an existing record in a form with a selectItem that allows an empty value: Code:
final SelectItem teaSel = new SelectItem("Teacher_id", "Teacher");
teaSel.setOptionDataSource(DataSource.get("Teacher"));
teaSel.setValueField("Teacher_id");
teaSel.setDisplayField("surname");
teaSel.setAllowEmptyValue(true);
Code:
form.saveData(); I remember this used to work before, so is it a small regression? All my forms with this kind of behaviour throughout my app suffer from this. |
|
#2
|
|||
|
|||
|
This could be influence by DataSource and form settings and depends on what kind of DataSource it is (REST, SGWT server, etc). Can you make this into a minimal test case? Then we can take a look.
|
|
#3
|
|||
|
|||
|
Will try.
Some details already: 1. I use smartgwt server , and the datasource is a normal SQL datasource. 2. The field is not being sent to the server, ie. it's just not present in the json object sent to the server. Also, so far it seems that it happens with foreign keys, as this Datasource definition shows. The Teacher_id and Location_id are set using a SelectItem, and shows the problem. The SQL definition allows null for the fields Teacher_id and Location_id, obviously. Code:
<?xml version="1.0" encoding="UTF-8"?>
<DataSource ID="LectureTemplate" serverType="sql" tableName="LectureTemplate">
<fields>
<!-- Id, with primaryKey -->
<field name="LectureTemplate_id" type="sequence" primaryKey="true"/>
...
<field name="Course_id" type="integer" foreignKey="Course.Course_id">
<validators></validators>
</field>
<field name="Teacher_id" type="integer" foreignKey="Teacher.Teacher_id">
<validators></validators>
</field>
<field name="Location_id" type="integer" foreignKey="Location.Location_id">
<validators></validators>
</field>
</fields>
<operationBindings>
<operationBinding operationType="update" requiresAuthentication="true" requiresRole="CAN_UPDATE_LECTURETEMPLATE">
</operationBinding>
</operationBindings>
</DataSource>
|
|
#4
|
|||
|
|||
|
Finally had time to create a stand-alone testcase (see link). It is an Eclipse project + sql file to import as tables with relevant test data. I removed the /lib/ dir et al., to reduce file size.
http://www.sytematic.nl/SGWTTestCase.zip What to do to reproduce the problem: 0. Run the included .sql file to obtain the table structure + test data 1. Run the app 2. Set the Teacher or Location field to 'empty' 3. Click Save button 4. Observe that the database still has Location_id = 1, rather than NULL I wonder what causes this! |
|
#5
|
|||
|
|||
|
Thanks for your effort, but we don't take Eclipse projects as test cases (too many possibilities for there to be an issue in the project itself and too much time to set up). If this is a real bug, it should be trivial to modify one of the sample projects (eg builtInDS) to demonstrate it - then you can just post the changes and we can try it very easily, with no possibility of time blown troubleshooting .project files.
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OperationID for update operation in ListGrid | argopm | Technical Q&A | 9 | 12th May 2011 18:00 |
| How to avoid dragging operation being interrupted by a DS update? | fatzopilot | Smart GWT Technical Q&A | 2 | 4th May 2011 17:43 |
| Mass update doesnt work for listgrid deletes? | muz715 | Smart GWT Technical Q&A | 3 | 29th Apr 2011 05:28 |
| Calling Update operation on the click of a button | naiksank | Smart GWT Technical Q&A | 0 | 28th Feb 2011 03:23 |
| update operation sends record without primary key | lazinskip | Smart GWT Technical Q&A | 4 | 16th Mar 2009 04:19 |