Announcement

Collapse
No announcement yet.

Filtering When Calling createView

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Filtering When Calling createView

    Taking the following JS, how can I apply a default filter to this when the view is created?

    Code:
    actionSelectRecord: function () {[INDENT]this.notify('Loading...');
    var viewName = this.getMetadata().get('clientDefs.Record.modalVie ws.select') || 'views/modals/select-records';
    
    this.createView('dialog', viewName, {[/INDENT][INDENT=2]scope: 'Record',
    createButton: false,
    forceSelectAllAttributes: true,
    // WHAT CAN I PUT HERE TO ENABLE FILTERING OF "RECORD" ENTITIES?[/INDENT][INDENT]}, function (view) {[/INDENT][INDENT=2]view.render();
    this.notify(false);
    this.listenToOnce(view, 'select', function (model) {[/INDENT][INDENT=3]view.close();
    this.selectRecord(model);[/INDENT][INDENT=2]}, this);[/INDENT][INDENT]}.bind(this));[/INDENT]
     },
    Last edited by blueprint; 01-28-2020, 04:42 PM.

  • #2
    Ok,so I've kinda got this working using the following syntax:

    Code:
    var filters = {};
    filters['account'] = {[INDENT]type: 'equals',
    field: 'accountId',
    value: this.accountId,
    data: {
    type: 'is',
    nameValue: this.accountName
    }[/INDENT]
     
    };
    And then apply it as follows:

    Code:
    this.createView('dialog', viewName, {[INDENT]scope: 'Record',
    createButton: true,
    forceSelectAllAttributes: true,
    filters: filters
    }, function (view) {[/INDENT][INDENT=2]view.render();
    this.notify(false);
    this.listenToOnce(view, 'select', function (model) {[/INDENT][INDENT=3]view.close();
    this.selectRecord(model);[/INDENT][INDENT=2]}, this);[/INDENT][INDENT]}.bind(this));
    [/INDENT]
    Last edited by blueprint; 01-28-2020, 04:44 PM.

    Comment

    Working...
    X