Announcement

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

    Filter select item has value of other filter field

    I will do my best to explain as good as I can the problem I have just discovered.

    I have a screen with a grid of employees and a dynamic form to edit them. Grid and form use the same REST-ful data source:

    Code:
    this.employeesDataSource = isc.RestDataSource.create({
      ...,
      fields: [
        {name: 'id', hidden: true, primaryKey: true, required: true, type: 'integer'},
        {name: 'name', required: true, type: 'text'},
        {name: 'number', required: true, type: 'integer'},
        {name: 'company_id', displayField: 'name', optionDataSource: app.companiesDataSource, required: true, type: 'integer', valueField: 'id'},
        ...
      ]
    });
    The grid has a filter editor and is defined like this:

    Code:
    this.employeesGrid = isc.ListGrid.create({
      ...,
      fields: [
        {name: 'number', width: 60},
        {name: 'name', width: '*'},
        {
          name: 'company_id',
          align: 'left',
          filterEditorProperties: {
            getPickListFilterCriteria: function () {
              return {
                fieldName: 'id',
                operator: 'inSet',
                value: [...]
              };
            }
          },
          title: 'Company'
        }
      ],
      showFilterEditor: true
    });
    So the grid shows fields "number", "name" and "company_id". As soon as I enter a filter for "name" and submit the filter, it populates the filter for company_id with the same value. I've found that changing the displayField of the optionDataSource for company_id to another name than "name" does prevent this behaviour, but of course the grid displays only company IDs instead of names.

    In the developer console I see the following message and I think it might be related to the error, but I am not sure:

    WARN:RecordEditor:isc_ListGrid_184filterEditor:ListGrid initialized with this.fields attribute set to an array containing fields which are already being displayed in another ListGrid instance. To reuse standard field configuration across multiple ListGrids, use listGrid.defaultFields rather than assigning directly to listGrid.fields.
    So I've tried to use "defaultFields" (which isn't documented by the way) instead of "fields" in the grid, but this doesn't help. I must also say the form uses the company_id field as well including a getPickListFilterCriteria() method.

    Any ideas?
    Last edited by wallytax; 17 Aug 2010, 04:54.

    #2
    I've added a picture of the filter that make the problem clear. I also found out it only fills the filter of "company" as long as it's empty. So when I'm typing a new text in the "name" filter, it won't update the value of the "company" filter
    Attached Files

    Comment


      #3
      You're not allowed to use the same fields in two ListGrid instances, as the warning states. The advice about defaultFields is for subclasses of ListGrid which have default fields, you may be more directly sharing fields? Either way, you need to eliminate the warning, have you?

      Finally, you forgot to mention version, browser, etc.

      Comment

      Working...
      X