Announcement

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

    Incorrect behavior using the new 'selectOnClick' flag in one case

    Hi,

    We have detected an incorrect behavior using the new 'selectOnClick' flag when editing in grid.

    If the value of the field that catches the focus is not empty and not the number 0, the behaviour is the proper one and the value of the now focused field is selected. But, if the value of the now focused field is 0, the value is not selected, although the field gets the focus properly. 

    This can be tested in current live examples [1] with the following massUpdate.js 

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true, cellHeight:22,
        // use server-side dataSource so edits are retained across page transitions
        dataSource: countryDS,
        // display a subset of fields from the datasource
        fields:[
            {name:"countryName"},
            {name:"continent"},
            {name:"member_g8"},
            {name:"population"},
            {name:"independence"}
        ],
        autoFetchData: true,
        canEdit: true,
        editEvent: "click",
        listEndEditAction: "next",
        autoSaveEdits: false,
    getEditorProperties: function (field) {
        var editor = this.Super("getEditorProperties", arguments);
        editor.selectOnClick = true;
        return editor;
    },
    })
    
    isc.IButton.create({
        top:250,
        title:"Edit New",
        click:"countryList.startEditingNew()"
    });
    
    
    isc.IButton.create({
        top:250, left: 110,
        title:"Save",
        click:"countryList.saveAllEdits()"
    });
    
    isc.IButton.create({
        top:250, left: 220,
        title:"Discard",
        click:"countryList.discardAllEdits()"
    });
    The problem seems to be in the handleMouseDown function of FormItem, in this code snippet.

    Code:
    var value = this._value;
            if (itemInfo && itemInfo.overElement &&
             !this.hasFocus && returnValue != false &&
             this._shouldSelectOnClick() && this._canSetSelectionRange()
             && value != null && value != isc.emptyString)
            {
             this.setSelectionRange(0,0);
             this._selectValueOnMouseUp = true;
            }
    The problem is that if the number 0 is compared with isc.emptyString with the != operator, the result is false. We think that the !== operator should be used instead.

    Regards

    ---
    [1] http://www.smartclient.com/#massUpdateFS
    Last edited by martintaal; 17 Sep 2015, 06:35.

    #2
    Your analysis makes sense. Thanks for the notification. We'll make the change you suggest and update 10.0 and 10.1 today. The change should be present in the next nightly build (dated Sep 19 or above)

    Regards
    Isomorphic Software

    Comment

    Working...
    X