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

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

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

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

    Comment

    Working...
    X