Announcement

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

    SpinneItem default value issue

    Hi Isomorphic,

    we have editable grid where one of the fields has set editor to be SpinnerItem.
    SpinnerItem has set default value to 1.
    When user removes value from the item manually, after closing the editor default value is not automatically applied.

    Reproduced on com.smartgwt.sample.showcase.client.grid.editing.GridCustomEditorsSample

    Code:
    ListGridField populationField = new ListGridField("population", "Population", 100);
    final SpinnerItem editorProperties = new SpinnerItem();
    editorProperties.setDefaultValue(1);
    populationField.setEditorProperties(editorProperties);
    Click image for larger version

Name:	spinner-item-default-value-issue-grid.gif
Views:	140
Size:	151.3 KB
ID:	248089

    SmartClient Version: v10.0p_2017-08-02/LGPL Development Only (built 2017-08-02)
    Google Chrome Version 58.0.3029.81 (64-bit)
    Attached Files

    #2
    Hi matus_b,

    IMHO you are removing the value. That there is no value after removing the current value is correct, isn't it?
    When you enter the row again, and the column has no value, the value is set to 1. This is, what "default value" means. That's all correct, isn't it?

    If you want to have the value reset to 1, once you enpty the FormItem, I assume you will need a ChangeHandler.

    Best regards
    Blama

    Comment


      #3
      hi Blama

      Value used when no value is provided for this item. Note that whenever this item's value is cleared by the user or set to null programmatically, it will be reverted to the defaultValue.
      http://www.smartclient.com/smartgwte...a.lang.Integer)

      In my case value is cleared by the user and it shall be reverted to defaultValue when the SpinnerItem loses focus.
      When the row is switched back from edit mode to view mode, it will read values of items in EditRowForm and set them to EditedRecord.
      I expect, that in this moment SpinnerItem should already return defaultValue and not null.

      Now, I am thinking, that I might misunderstood what is meant by clearing item's value.
      Maybe it is only user's action witch will call clearValue() on FormItem.

      I expected that, if FormItems has default value set, then anytime when the real value becomes null, it will be replaced with default value.

      Comment


        #4
        Sorry, you are right IMHO. Is the behavior the same if you just change FormItems within the currently edited row (not select a different row)?

        Best regards
        Blama

        Comment


          #5
          I extended showcase with the default value also for TextItem editor for Government column.

          Code:
                  ListGridField governmentField = new ListGridField("government", "Government", 175);
                  final TextItem governmentEditorProperties = new TextItem();
                  governmentEditorProperties.setDefaultValue("default");
                  governmentField.setEditorProperties(governmentEditorProperties);
          Blama : moving focus between the editors on the same rows works as expected - default value is applied after item loses focus.
          Click image for larger version

Name:	spinner-item-default-value-issue-grid-row-clicks.gif
Views:	129
Size:	105.5 KB
ID:	248126

          And now how the same items behave when moving focus to another row:
          Click image for larger version

Name:	spinner-item-default-value-issue-grid-text-out.gif
Views:	110
Size:	45.2 KB
ID:	248127
          Click image for larger version

Name:	spinner-item-default-value-issue-grid-spinner-out.gif
Views:	114
Size:	68.1 KB
ID:	248128

          Comment


            #6
            Yes, we see this issue and we're looking into it - we'll get back to you with more information shortly.
            Last edited by Isomorphic; 7 Aug 2017, 22:54.

            Comment


              #7
              This has been fixed for builds dated August 9 and later.

              Comment

              Working...
              X