Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with missing Textfield when using DateItem

    Hi Isomorphic,

    I think I found a problem with DateItem. Please see the attached screenshot (I'd expect a text field for the selected date between the field-title and the datepicker-icon). I use the object as I did before (2 month ago, so I can't tell when the bug are introduced).

    See this form code:

    Client Java (look for gueltigvonDI and gueltigbisDI):
    Code:
    package com.lmscompany.lms.client.menu.list;
    
    import com.lmscompany.lms.client.User;
    import com.lmscompany.lms.client.menu.navigation.MainArea;
    import com.lmscompany.lms.client.type.DatasourceEnum;
    import com.lmscompany.lms.client.type.CompanyListType;
    import com.lmscompany.lms.client.util.Helper;
    import com.smartgwt.client.data.DSCallback;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.data.DSResponse;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
    import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
    import com.smartgwt.client.widgets.form.fields.DateItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class CompanyUserList extends VLayout {
    	final private DataSource userDS = DataSource.get(DatasourceEnum.T_USER
    			.getValue());
    	final private UserList boundList;
    	private DynamicForm newForm;
    
    	public CompanyUserList(final MainArea mainArea) {
    		super(5);
    
    		boundList = new UserList(mainArea, CompanyListType.COMPANY, null);
    		addMember(boundList);
    
    		HLayout newEntryLayout = new HLayout() {
    			{
    				setHeight(30);
    				newForm = new DynamicForm() {
    					@Override
    					public void saveData() {
    						super.saveData(new DSCallback() {
    							@Override
    							public void execute(DSResponse response,
    									Object rawData, DSRequest request) {
    								if (Helper.oneRow(response)) {
    									newForm.clearValues();
    									int newUserID = response
    											.getDataAsRecordList()
    											.first()
    											.getAttributeAsInt(
    													newForm.getDataSource()
    															.getPrimaryKeyFieldName());
    									// UserList.openPersonDetailTab(newUserID,
    									// mainArea,
    									// CompanyListType.COMPANY);
    								}
    							}
    						});
    					}
    
    					{
    						setWidth100();
    						setDataSource(userDS);
    						setNumCols(6);
    						setMembersMargin(5);
    						setIsGroup(true);
    						setGroupTitle("Basisdaten des neuen Benutzers (Details können im folgenden Schritt gepflegt werden)");
    						setSaveOnEnter(true);
    						setCanSubmit(false);
    						addSubmitValuesHandler(new SubmitValuesHandler() {
    							public void onSubmitValues(
    									final SubmitValuesEvent submitValuesEvent) {
    								saveData();
    							}
    						});
    						final TextItem anredeTI = new TextItem("ANREDE");
    						final TextItem vornameTI = new TextItem("GIVENNAME");
    						final TextItem nachnameTI = new TextItem("SURNAME");
    						final DateItem gueltigvonDI = new DateItem("GUELTIGVON");
    						final DateItem gueltigbisDI = new DateItem("GUELTIGBIS");
    						final TextItem emailTI = new TextItem("EMAIL");
    						setValue("BELONGSTO_COMPANY_ID", User.getParentID());
    						setFields(gueltigvonDI, gueltigbisDI, emailTI,
    								anredeTI, vornameTI, nachnameTI);
    					};
    				};
    				final IButton newBtn = new IButton("Neuen Benutzer hinzufügen",
    						new ClickHandler() {
    							@Override
    							public void onClick(ClickEvent event) {
    								newForm.saveData();
    							};
    						}) {
    					{
    						setWidth(200); // Button
    					}
    				};
    				addMember(newBtn);
    				addMember(newForm);
    			}
    		};
    		addMember(newEntryLayout);
    	}
    }
    ds.xml:
    Code:
    		<field name="GUELTIGVON" title="Login gueltig von" type="date" required="true"></field>
    		<field name="GUELTIGBIS" title="Login gueltig bis" type="date"></field>
    Could you please confirm if this is a bug?

    Thank you & Best regards,
    Blama
    Attached Files

    #2
    Hi,

    perhaps this is linked in some way to http://forums.smartclient.com/showth...light=DateItem?

    I'm on FF 19.0.1, v8.3p_2013-03-11/EVAL.
    Doctype .html: "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">"

    Thanks again,
    Blama

    Comment


      #3
      What version are you using? Remember to always post this.

      Your test case can't be run (no DataSource), but it suggests that the fields are marked as not editable in the DataSource, in which case this would be the expected behavior.

      Comment


        #4
        Missing information

        Hi Isomorphic,

        here the missing information:
        Browser: FF 19.0.1 (+google hosted mode plugin for FF 1.19)
        SGWT: v8.3p_2013-03-11/EVAL Deployment
        GWT: 2.5.0
        Eclipse Juno SR2

        ds.xml field list:
        Code:
        <!-- Auto-generated from database table T_USER -->
        
        <DataSource dbName="Oracle" tableName="T_USER" ID="T_USER" dataSourceVersion="1" generatedBy="v8.3p_2013-03-07/EVAL Deployment 2013-03-07"
        	serverType="sql">
        	<fields>
        		<field primaryKey="true" hidden="true" name="ID" type="sequence"></field>
        		<field foreignKey="T_USER.TENANT_ID" hidden="true" name="TENANT_ID" title="TENANT_ID" type="integer" required="true"></field>
        		<field foreignKey="T_USER.ID" name="MODIFIED_BY" title="Geändert von" type="integer" required="true"></field>
        		<field name="MODIFIED_AT" title="Geändert am" type="date" required="true"></field>
        		<field foreignKey="T_COMPANY.ID" name="BELONGSTO_COMPANY_ID" title="Firma" type="integer"></field>
        		<field foreignKey="T_DISTRIBUTOR.ID" name="BELONGSTO_DISTRIBUTOR_ID" title="Distributor" type="integer"></field>
        		<field foreignKey="T_RESELLER.ID" name="BELONGSTO_RESELLER_ID" title="Reseller" type="integer"></field>
        		<field name="ANREDE" title="Anrede" length="10" type="text"></field>
        		<field name="GIVENNAME" title="Vorname" length="30" type="text"></field>
        		<field name="SURNAME" title="Nachname" length="30" type="text" required="true"></field>
        		<field name="LOGINNAME" title="Loginname" length="20" type="text" required="true">
        			<validators>
        				<validator type="isUnique" errorMessage="Der Benutzername ist schon vergeben!"></validator>
        			</validators>
        		</field>
        		<field name="FUNCTION" title="Funktion" length="50" type="text" required="true"></field>
        		<field name="BCRYPTHASH" title="Passwort" length="60" type="text" required="true"></field>
        		<field name="GUELTIGVON" title="Login gueltig von" type="date" required="true" canEdit="true"></field>
        		<!-- Validator hinzufügen -->
        		<field name="GUELTIGBIS" title="Login gueltig bis" type="date" canEdit="true"></field>
        		<!-- Validator hinzufügen -->
        		<field name="FEHLERHAFT" title="Anzahl fehlerhafter Logins" type="integer" required="true"></field>
        		<field name="LASTLOGIN" title="letztes Login am" type="datetime"></field>
        		<field name="EMAIL" title="eMail" length="50" type="text">
        			<field name="FIRMENNAME"
        				customSelect="CASE WHEN c.name IS NULL AND d.name IS NULL THEN 'Reseller: ' || r.name WHEN c.name IS NULL AND r.name IS NULL THEN 'Distributor: ' || d.name WHEN d.name IS NULL AND r.name IS NULL THEN 'Firma: ' || c.name END"></field>
        			<validators>
        				<validator type="regexp"
        					expression="^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]{2}|[cC][oO][mM]|[oO][rR][gG]|[nN][eE][tT]|[eE][dD][uU]|[gG][oO][vV]|[mM][iI][lL]|[bB][iI][zZ]|[iI][nN][fF][oO]|[mM][oO][bB][iI]|[nN][aA][mM][eE]|[aA][eE][rR][oO]|[aA][sS][iI][aA]|[jJ][oO][bB][sS]|[mM][uU][sS][eE][uU][mM])$"
        					errorMessage="Bitte geben Sie eine gültige Emailadresse ein."></validator>
        			</validators>
        		</field>
        	</fields>
        As you can see I added "canEdit", which didn't make a difference.

        Thanks,
        Blama

        Comment


          #5
          no bug!

          Hi Isomorphic,

          I'm sorry, it was my fault.
          I tried to recompile my old testproject with the current version of the framework -> OK.
          I compared the ds-files used now and then -> OK.
          I then looked in the java code and saw that I forgot setUseTextField(true);.

          So everything is working as expected. I guess that what's happening, if you can't program much.

          Thanks!
          Blama

          Comment

          Working...
          X