Announcement

Collapse
No announcement yet.

Simple Link Field without a modal window?

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

  • Simple Link Field without a modal window?

    Hello,

    Is it possible to have a simple link field without a modal window? Essentially, what I'm after here is a link that acts like an enum (ie. when displayed on the detail view) the link field is a simple enum with options populated in accordance with the link id=>name value pairs ?

    Edit 1: Actually, I just realized that when I start to type into the select field it shows me options without ever having to open the modal window; so that solves half my problem. I suppose the other half is: can we display all the options inside the select text box as soon as we cursor in? I notice that if I use '*' in the text box as shown below it displays all options to select. How can I create this behavior anytime the cursor moves into the select box?

    Edit 2: Ok, I'm making some progress but I'm stuck now. It looks like one can set getEmptyAutoCompleteResult of 'views/fields/link' to return a list array of id, name pairs to be shown when there is no data in the select box and the user cursor's into it. But how do I create that list dynamically to return all records of the entity and not just a static one like shown below?

    PHP Code:
    getEmptyAutocompleteResult: function () {
        return {
              list: [
                   {
                       
    id'631c87aef2c86520a',
                       
    name'Intraoral',
                   }
              ]
        };
    },
    ​ 


    Would it be something similar to the following ? If so, how can structure it so it waits on the return data? :

    PHP Code:
    getEmptyAutocompleteResult: function () {
        
    Espo.Ajax.getRequest(linkName)
    },
    ​ 
    ​​

    Edit 3: Ok, I finally figured this out. Here is the solution for getEmptyAutocompleteResult of link field
    PHP Code:
    getEmptyAutocompleteResult: function(){
        
    let myList = {};
        
    this.wait(true);
        
    Espo.Ajax.getRequest(url,{}, {async:false}).done(function (json) {
            
    myList json;
        });
        
    this.wait(false);
        return 
    myList;

    Attached Files
    Last edited by czcpf; 09-13-2022, 05:42 AM. Reason: Solved.
Working...
X