Navigation

    Quasar Framework

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    table of q-selects - how to filter

    Help
    2
    3
    13
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CWoodman
      CWoodman last edited by

      I have a q-table and each row has a q-select. I want to have autocomplete, but unable to pass the row index to the filter function.

      The q-select includes this prop:

      @filter="filterFn(props.row.rowIndex)
      

      and the filter method looks like this:

      filterFn (val, update, abort, rowIndex) {
         if (this.tableRows[rowIndex].itemList.length <= 0 || !val || val.length < 2) {
              abort()
              return
          }
      
          update(() => {
              const needle = val.toLowerCase()
              this.options = this.tableRows[rowIndex].itemList.filter(v => v.toLowerCase().indexOf(needle) > -1)
          })
      },
      

      But the rowIndex parameter is not getting passed.

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @CWoodman last edited by

        @CWoodman said in table of q-selects - how to filter:

        @filter

        you can use function currying:

         @filter="(val, update, abort) => filterFn(val, update, abort, props.row.rowIndex)"
        
        1 Reply Last reply Reply Quote 0
        • CWoodman
          CWoodman last edited by

          Great! thanks.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post