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?

    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));
    },

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

    var filters = {};
    filters['account'] = {
    type: 'equals',
    field: 'accountId',
    value: this.accountId,
    data: {
    type: 'is',
    nameValue: this.accountName
    }
    };

    And then apply it as follows:

    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));

    Comment

    Working...
    X