No announcement yet.
  • 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

    ListGridField populationField = new ListGridField("population", "Population", 100);
    final SpinnerItem editorProperties = new SpinnerItem();
    Click image for larger version

Name:	spinner-item-default-value-issue-grid.gif
Views:	143
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

    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


      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.

      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.


        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


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

                  ListGridField governmentField = new ListGridField("government", "Government", 175);
                  final TextItem governmentEditorProperties = new TextItem();
          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:	132
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:	113
Size:	45.2 KB
ID:	248127
          Click image for larger version

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


            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.


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