JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Text Boxes & Inputs Change query param into autocomplete datasource function

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #103098
    Rafa Esparza
    Participant

    Hi,
    i’m trying to change the value of the query parameter of the datasource function. The input value is different of the values of the value of datasource.

    ei: My datasource: {label:’4000-name’, value:’4000′} and the input is ‘4.0’.
    Inside the datasource function i transform the ‘4.0’ to ‘4000’. The result of the autocomplete list in the function is correct but in the view says ‘no items values found’.
    i attach the function

     <smart-text-box #ctactbbanco form-control-name="ctactbbanco" name="ctactbbanco" id="ctactbbanco" [autoComplete]="'inline'" [displayMember]="'label'" 
      [valueMember]="'value'" [inputMember]="'value'" [minLength]="1" [dropDownPlaceholder]="'No hay cuentas contables.'"></smart-text-box>
    
     this.inputCtactbbanco.dataSource = (query: string, callback: Function): void => {
              let result: Array<object> = [];
              if (query.includes('.')){
                query = Utils.puntoToNumeroCuenta(query); // 4.0 transform to 4000
              }
              for (let d = 0; d < autocomplete.length; d++) {
                if (autocomplete[d].label.toLowerCase().indexOf(query.toLowerCase()) > -1) {
                  result.push(autocomplete[d]);
                }
              }
              // result has the correct list with the elements with 4000 in their values, but in the view arent showing them
              callback(result);
            };
    

    Thanks in advance

    #103103
    admin
    Keymaster

    Hi Rafa,

    To change the query dynamically, you can use Smart.Input instead.

    Example: https://www.htmlelements.com/demos/input/input-suggest/

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.