getSelectFilters for multi-enum field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    getSelectFilters for multi-enum field

    I have a relationship in the account entity one to many (account parent => subsidiaries) and i have a multi-enum field (accountType labeled as Company Type) on the account with values (Client - Accountant - Introducer), i have created a custom view for the (account parent) field so that when i select parent account i want to chose only from accounts that have accountType of Client. Everything works fine so far and the custom field works fine however i am struggling to get the value (Client) select on the accountType (Company Type) whne the list is show: below the code for my custom field

    Code:
    Espo.define('custom:views/account/fields/account-parent', 'views/fields/link', function (Dep) {
    
    return Dep.extend({
    
    getSelectFilters: function () {
    return {
    'accountType': {
    type: 'arrayAnyOf',
    attribute: 'accountType',
    value: ["Client"],
    }
    };
    },
    
    });
    });
    If this a bug for multi-enum field or am i missing something on the getSelectFilters method? by the way none of the other type works for multi-enum field like (equals / in / is ) they all don't work for multi-enum field. attached a screenshot. Is there any way just to make sure the value set in the getSelectFilters is reflected on the UI. screenshot show that the code works and filter only brings accounts of type (Client) just missing that value.

    thanks
    Attached Files
    Rabii
    Web Dev
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    Solved, for anyone interested in using multi-enum for filtering code below should work if filtering using type (anyOf):

    Code:
    Espo.define('custom:views/account/fields/accountant', 'views/fields/link', function (Dep) {
    
    return Dep.extend({
    
    getSelectFilters: function () {
    var valueList = ['Accountant'];
    return {
    'accountType': {
    type: 'arrayAnyOf',
    value: valueList,
    data: {
    type: 'anyOf',
    valueList: valueList,
    }
    }
    };
    },
    
    });
    });
    Cheers
    Rabii
    Web Dev

    Comment

    Working...