Announcement

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

  • 12p ignores listGrid.setEditorProperties FormItem with canEdit=false

    Hi,
    We have been using LinkItem as cell editor in ListGrid. The goal is to allow user pick a file through icon while text entry is blocked. This sample illustrates scenario and has been working fine in our production version based on 11.1p (SmartClient Version: v11.1p_2017-09-10/LGPL Development Only (built 2017-09-10)):
    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.RestDataSource;
    import com.smartgwt.client.data.fields.DataSourceDateField;
    import com.smartgwt.client.data.fields.DataSourceFloatField;
    import com.smartgwt.client.data.fields.DataSourceLinkField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.FieldType;
    import com.smartgwt.client.types.ListGridEditEvent;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.FormItemIcon;
    import com.smartgwt.client.widgets.grid.CellFormatter;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    
    public class MainEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
    
            layout();
        }
    
        private void layout() {
    
            final RestDataSource ds = new RestDataSource();
            ds.setDataURL("UnitDir.xml");
            DataSourceField fieldId = new DataSourceField();
            fieldId.setName("id");
            fieldId.setPrimaryKey(true);
            fieldId.setHidden(true);
            DataSourceTextField fieldCode = new DataSourceTextField();
            fieldCode.setName("code");
            DataSourceLinkField fieldDescription = new DataSourceLinkField("description");
            ds.setFields(fieldId, fieldCode, fieldDescription);
    
            final ListGrid lg = new ListGrid();
            lg.setDataSource(ds);
            lg.setAutoFetchData(true);
            lg.setWidth(300);
            lg.setCanEdit(true);
            lg.setEditEvent(ListGridEditEvent.DOUBLECLICK);
    
            ListGridField codeLGF = new ListGridField("code");
    
            ListGridField descriptionLGF = new ListGridField("description");
            FormItem item = new FormItem();
            FormItemIcon uploadIcon = new FormItemIcon();
            item.setIcons(uploadIcon);
            item.setHeight(30);
            item.setCanEdit(false);//<---!?
            descriptionLGF.setEditorProperties(item);
    
            lg.setFields(codeLGF, descriptionLGF);
    
            lg.draw();
        }
    }
    Click image for larger version

Name:	lg_canEdit_11.1p.png
Views:	1
Size:	7.1 KB
ID:	253106

    After upgrading to 12p (SmartClient Version: v12.0p_2018-03-27/LGPL Development Only (built 2018-03-27)) the same sample seems to ignore editorProperties {canEdit: false}
    Click image for larger version

Name:	lg_canEdit_12p.png
Views:	1
Size:	7.2 KB
ID:	253107

    Is it a regression? Can we have it corrected?
    Thanks,
    MichalG

    UnitDir.xml
    Code:
    <response>
        <requestId>UnitDir_request5</requestId>
        <startRow>0</startRow>
        <endRow>76</endRow>
        <totalRows>77</totalRows>
        <data>
            <UnitDir>
                <id>341</id>
                <code>kg</code>
                <description>kilogram</description>
                <validFrom>2015-05-26</validFrom>
                <validTo>2015-05-28</validTo>
                <quantity>10.5</quantity>
            </UnitDir>
            <UnitDir>
                <id>342</id>
                <code>szt</code>
                <description>sztuki</description>
                <validFrom>2015-05-26</validFrom>
                <quantity>11.75</quantity>
            </UnitDir>
            <UnitDir>
                <id>343</id>
                <code>sztuki</code>
                <description>sztuki</description>
                <validFrom>2015-05-26</validFrom>
                <quantity>10000</quantity>
            </UnitDir>
        </data>
        <requestedDataSource>UnitDir</requestedDataSource>
        <status>STATUS_SUCCESS</status>
    </response>

  • #2
    This is due to a ListGrid behavior where canEdit is interactively updated (in your case, switched back on) for editor items, according to field editability.

    We're taking a look at the best solution and we'll update here when it's fixed.

    Comment


    • #3
      This has been fixed for builds dated May 11 and later.

      Comment


      • #4
        Tested with SmartClient Version: v12.0p_2018-05-11/LGPL Development Only (built 2018-05-11) and got the following js exception while entering edit mode (double click):
        Code:
        13:12:17.748:TMR5:WARN:Log:TypeError: Cannot read property 'undefined' of undefined
        Stack from error.stack:
            getInactiveContext(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:5415:39
            _determineRowNum(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_0] @ ListGrid.js:33852:40
            hasFieldErrors(<no args: exited>) on [DynamicForm ID:isc_DynamicForm_0] @ ListGrid.js:33818:39
            hasErrors(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:14285:49
            getErrorWidth(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:4850:48
            _getErrorWidthAdjustment(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:4868:31
            getTextBoxWidth(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:4841:34
            getTextBoxCSS(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:7017:41
            getReadOnlyHTML(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ LinkItem.js:230:28
            _getTableHTML(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:6431:44
            getInnerHTML(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:5985:30
            getStandaloneItemHTML(<no args: exited>) on [LinkItem ID:isc_LinkItem_0 name:description] @ FormItem.js:5529:32
            getEditItemCellValue(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:24792:21
            getCellValue(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:23479:30
            eval(<no args: exited>) on [GridBody ID:isc_ListGrid_0_body] @ [no file]:4:127
            _getCellValue(<no args: exited>) on [GridBody ID:isc_ListGrid_0_body] @ GridRenderer.js:3987:56
            refreshCellValue(<no args: exited>) on [GridBody ID:isc_ListGrid_0_body] @ GridRenderer.js:5893:20
            refreshCellValue(<no args: exited>) on [GridBody ID:isc_ListGrid_0_body] @ ListGrid.js:1079:62
            refreshCellValue(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:35154:10
            refreshCell(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:34991:14
            _showEditForm(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:33217:22
            showInlineEditor(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:33016:10
            _startEditing(<no args: exited>) on [ListGrid ID:isc_ListGrid_0] @ ListGrid.js:32748:10
            fireCallback(callback=>Obj, argNames=>undef, args=>Array[1], target=>[ListGrid ID:isc_ListGrid_0], catchErrors=>true) on [Class Timer] @ Class.js:1865:36
            _fireTimeout(ID=>"_timeout16", tmrID=>25, delayedTmrID=>undef) on [Class Timer] @ Timer.js:279:10
            <anonymous>() @ Timer.js:201:19
        MichalG
        Browser chrominium 38.0.2125.101 (290379) (64-bit); clean build and browser cache cleard

        Comment


        • #5
          Sorry about that, we'll apply a fix later today.

          Comment


          • #6
            Apologies for the delay on this one - it's just been fixed and you can test it out in builds dated May 17 and later.

            Comment


            • #7
              Tested with SmartClient Version: v12.0p_2018-05-18/LGPL Development Only (built 2018-05-18)
              and verified as fixed.
              Thank you kindly,
              MichalG

              Comment

              Working...
              X