Announcement

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

    DynamicForm and editorExit function

    SmartClient Version: v10.1p_2018-02-27/Enterprise Deployment (built 2018-02-27)
    Browser: Chrome, Firefox, IE 10.

    Hello,

    I am running into a problem when using the editorExit event function on a simple text item on a DynamicForm. The behavior of the form changes based on whether the code within the eventExit affects another window or not.

    Test Case: Change the text in "Country Name contains" and click "Filter" button.

    The follow works as I expect. The editor exit has no effect on the screen and the Filter button executes.

    isc.DynamicForm.create({
    ID: "filterForm",
    width: 300,
    operator: "and",
    saveOnEnter: true,
    dataSource: worldDS,
    submit: function () {
    filterGrid.filterData(filterForm.getValuesAsCriteria());
    },
    fields: [
    {name: "countryName",
    title: "Country Name contains",
    type: "text",
    blur: function() {
    isc.DataSource.get(worldDS).fetchData({}, "isc.logEcho('Fetch')");
    }
    },
    {type: "blurb",
    defaultValue: "<b>AND</b>"
    },
    {name: "population",
    title: "Population smaller than",
    type: "number",
    operator: "lessThan"
    },
    {type: "blurb",
    defaultValue: "<b>AND</b>"
    },
    {name: "independence",
    title: "Nationhood later than",
    type: "date",
    useTextField: true,
    operator: "greaterThan"
    }
    ]
    });

    isc.ListGrid.create({
    ID: "filterGrid",
    top: 150,
    width:750, height:300, alternateRecordStyles:true,
    dataSource: worldDS,
    autoFetchData: true,
    useAllDataSourceFields: true
    })

    isc.IButton.create({
    left: 320,
    title: "Filter",
    click: function () {
    filterForm.submit();
    isc.say("Filtered");
    }
    });

    This one doesn't quite work as I would like it to. The editor exit pops up a window and prevents the Filter Button from click event from firing:

    isc.DynamicForm.create({
    ID: "filterForm",
    width: 300,
    operator: "and",
    saveOnEnter: true,
    dataSource: worldDS,
    submit: function () {
    filterGrid.filterData(filterForm.getValuesAsCriteria());
    },
    fields: [
    {name: "countryName",
    title: "Country Name contains",
    type: "text",
    blur: function() {
    isc.DataSource.get(worldDS).fetchData({}, "isc.say('Fetch')");
    }
    },
    {type: "blurb",
    defaultValue: "<b>AND</b>"
    },
    {name: "population",
    title: "Population smaller than",
    type: "number",
    operator: "lessThan"
    },
    {type: "blurb",
    defaultValue: "<b>AND</b>"
    },
    {name: "independence",
    title: "Nationhood later than",
    type: "date",
    useTextField: true,
    operator: "greaterThan"
    }
    ]
    });

    isc.ListGrid.create({
    ID: "filterGrid",
    top: 150,
    width:750, height:300, alternateRecordStyles:true,
    dataSource: worldDS,
    autoFetchData: true,
    useAllDataSourceFields: true
    })

    isc.IButton.create({
    left: 320,
    title: "Filter",
    click: function () {
    filterForm.submit();
    isc.say("Filtered");
    }
    });

    I obviously would prefer it to fire the "Filter" click function regardless of what else occurs on the editorExit event. Is there some way around this?

    Thanks.

    Paul Fincke

    #2
    I love how I find the answer 2 minutes after posting my question. For those interested, you can use "delayCall". I did so thusly:

    {name: "countryName",
    title: "Country Name contains",
    type: "text",
    editorExit: function() {
    this.delayCall("delayedFetch", [value], 500);
    },
    delayedFetch: function() {
    isc.DataSource.get(worldDS).fetchData({}, "isc.say('Fetch')");
    }
    },

    And my problem went away.

    Paul Fincke

    Comment


      #3
      Just FYI, another fix is to set showPrompt:false in the requestProperties argument of fetchData(). This turns off the interactivity-blocking prompt that normally appears during the network turnaround.

      Comment

      Working...
      X