Announcement

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

    ListGrid EditorCustomizer (like SmartGWT) in Smartclient

    smartclient 8.2

    I want to customize a listgrid cell editor of a field for different records like in the Custom Cell Editors SmartGWT sample http://www.smartclient.com/smartgwt/...m_editing_cell
    is it supported in Smartclient?

    but it's a bit more complicated, because I want to use a field which specifies the type, so the user could change the type and the editor of the cell must change dynamically. I will have custom DMI operations to convert accordingly the data.

    Is it possible?
    Last edited by claudiobosticco; 15 Mar 2012, 09:57.

    #2
    I also need a SelectItem in one cell to show an editor in another

    I am using SmartGWT v8.3p_2013-02-27/Pro Deployment (built 2013-02-27) and have this challenge in all browsers.

    Using ListGrid.setEditorCustomizer() works to trigger a custom editor when the user clicks on my VALUE cell and editing begins anew for that record.

    However, to the left of the VALUE cell I have a TYPE cell with a SelectItem (where a TYPE may be a STRING, BOOLEAN, NUMBER, etc.).

    When the user changes the TYPE, I need the VALUE cell to display the appropriate editor (ListGrid, SelectItem, Checkbox, etc.) while that row is already in edit mode.

    How to do this with the row already in edit mode?

    Comment


      #3
      We're not sure why either of you perceive a problem here. The setEditorCustomizer() API has no assumption in it which would prevent you from choosing an editor based on data values stored in the record.

      Comment


        #4
        Perceived problem...

        When the user changes the TYPE cell, I need the VALUE cell to change to the appropriate customized editor.

        The VALUE cell editor is not changing until I end row editing on the TYPE cell and then begin editing the row again by selecting the VALUE cell.

        Comment


          #5
          That suggests that you are not correctly checking the value of the TYPE cell. See the ListGrid Editing overview - you are probably consulting the Record values rather than the unsaved editValues.

          Comment


            #6
            Sample Code to reproduce condition

            Attached is a source file of sample code and below are the steps to produce the conditions that I am trying to resolve.

            I also included a screen shot of another problem that occurs randomly - duplicate row entry.


            a) Click 'New Row'
            b) Default to STRING for TYPE
            c) Enter a letter for VALUE
            d) Click outside edit row to save

            e) Click TYPE and select NUMBER
            f) Click outside edit row to save
            g) * error * validator did not execute to flag the letter as an invalid entry; the only way I have found to trigger the validator is to delete then re-enter a VALUE

            h) Click TYPE and select BOOL
            i) Click VALUE to set 'true' or 'false'
            j) * error * getEditor() did not execute to return the SelectItem
            k) Click outside edit row to save
            l) Click VALUE again and voila the SelectItem returned by getEditor()
            m) * error * the previously-entered VALUE is also present in the SelectItem but the SelectItem should have only 'true' and 'false' as options
            Should I clear the VALUE cell when the TYPE cell changes?

            n) The ValueSetItem is a work in progress...that code currently throws an exception when SET is chosen as the TYPE.
            Attached Files

            Comment


              #7
              Aha...it seems I was missing setEditByCell(true)

              It seems I was missing setEditByCell(true). However, the other problems remain but at least the custom editors are now activated upon selecting a type.

              Comment


                #8
                a) Click 'New Row'
                b) Default to STRING for TYPE
                c) Enter a letter for VALUE
                d) Click outside edit row to save

                e) Click TYPE and select NUMBER
                f) Click outside edit row to save
                g) * error * validator did not execute to flag the letter as an invalid entry; the only way I have found to trigger the validator is to delete then re-enter a VALUE
                The behavior here is actually as expected.
                The problem is that the value for the "Value" field has already been saved to the underlying record in step "d". We don't re-validate pre-existing data when the user attempts to save changes to a row, only the actual edits they are changing.

                ... skipping items presumably resolved via editByCell

                m) * error * the previously-entered VALUE is also present in the SelectItem but the SelectItem should have only 'true' and 'false' as options
                Should I clear the VALUE cell when the TYPE cell changes?
                Again this is expected behavior. The underlying record value is being displayed in the editor, which is typically what you want, even if it isn't explicitly listed in the valueMap for the item.

                It sounds like your best solution for both of these problems would indeed be to clear the VALUE cell automatically when the TYPE changes.

                Let us know if that won't work for you

                Regards
                Isomorphic Software

                Comment

                Working...
                X