Announcement

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

    setShowIfCondition shows next FormItem beside the previous FormItem, not below it in FF, GC.

    Hi! There is a simple scenario with two form items: CheckboxItem and TextItem on dynamic form. I would like to show/hide TextItem below CheckboxItem depending on condition. Actually the setShowIfCondition shows TextItem beside CheckboxItem, not below it, especially if the initial evaluation gives false in FF and in GC. The real world situation is more sophisticated with more items and conditions. I would like to show all items always in one column (so two columns inclusive title) in dynamic form. Is there some setting for setShowIfCondition to achieve it?

    Code:
    [B]private[/B] Layout getMyPanel() {
    [B]final[/B] VLayout vLayout = [B]new[/B] VLayout();
    [B]final[/B] DynamicForm dynamicForm = [B]new[/B] DynamicForm();
    [B]final[/B] CheckboxItem checkboxItem = [B]new[/B] CheckboxItem("check", "Checkbox");
                 checkboxItem.addChangedHandler([B]new[/B] ChangedHandler() {
                        @Override
    [B]public[/B] [B]void[/B] onChanged(ChangedEvent [U]event[/U]) {
                               dynamicForm.redraw();
                        }
                 });
                 TextItem textItem = [B]new[/B] TextItem("item", "Item");
                 textItem.setShowIfCondition([B]new[/B] FormItemIfFunction() {
                        @Override
    [B]public[/B] [B]boolean[/B] execute(FormItem [U]item[/U], Object [U]value[/U], DynamicForm [U]form[/U]) {
                               Boolean ret = (Boolean) checkboxItem.getValue();
    [B]return[/B] ret != [B]null[/B] && ret; // [U]ret[/U] == null || [U]ret[/U];
                        }
                 });
                 dynamicForm.setFields(checkboxItem, textItem);
                 vLayout.addMember(dynamicForm);
    [B]return[/B] vLayout;
           }
    ERR: FF ESR 24.8.1
    ERR: GC Version 60.0.3112.101 (Offizieller Build) (64-Bit)
    OK : IE 11 Version 11.713.10586.0, Update 11.0.38 (KB3203621)
    GWT Version : 2.6.0
    SmartGWT Version : 6.0p (Tue Feb 28 12:52:00 CET 2017)

    #2
    Hi bnagwt,

    this should work out of the box, see this sample and it's code.
    Perhaps you are setting numCols on your DynamicForm to a value not equal to the default of 2 (=title + item)?

    Best regards
    Blama

    Comment


      #3
      The show case sample works for each mentioned browsers above OK. I have tried dynamicForm.setNumCols(numCols) with various numCols values, it not helped. Finally and fortunately checkboxItem.setRedrawOnChange(true) is the solution as in the show case sample. Thank you. :-)

      Comment


        #4
        Hi bnagwt,

        great you got it working.
        Perhaps it should then be automatically set to true, if a FormItem uses setShowIfCondition() and that is really a precondition for showIf to work? Isomorphic?

        Best regards
        Blama

        Comment


          #5
          showIfs are evaluated when the item is redrawn. It can be redrawn for multiple reasons, and there is no reason to assume that setting a showIf condition implies that one wants redraws on change.

          Comment


            #6
            Hi Isomorphic,

            OK, thanks.

            Best regards
            Blama

            Comment

            Working...
            X