Distinguish between listMode for listing vs selecting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • czcpf
    Senior Member
    • Aug 2022
    • 160

    Distinguish between listMode for listing vs selecting

    Hello,

    For fields views we have a method like:

    Code:
    this.isListMode()
    This tells us the field is being displayed in list mode. Is there some way to also determine if the field is being displayed in list mode for 'selecting' vs. just listing ?

    As an example, say we have a link field in detail view. User selects it to open a window for selecting a record. One of the fields in those records is `myField` which has a custom view. Can we determine if `myField` is being displayed in listMode AND for selecting records vs just being displayed in listMode ?


    Code:
    this.isListMode()  && (i'm in a window for selecting records)
  • czcpf
    Senior Member
    • Aug 2022
    • 160

    #2
    Hello,

    After some digging, I came up with this solution. If anyone has any other suggestions please advise.

    Code:
    /**
    * Determine if the field is in a select modal list
    *
    * @return {boolean}
    */
    isListSelectMode: function() {
    
    if(!this.isListMode()) { return false; }
    
    let p = this.getParentView();
    
    if(!p) { return false; }
    
    //grandparent
    let gp = p.getParentView();
    
    if(!gp || !gp.hasOwnProperty('selectable')) { return false; }
    
    return gp.selectable;
    
    }​

    Comment

    Working...