`searchBuilderTitle` reference `` value?

`searchBuilderTitle` reference `` value?

lisarushlisarush Posts: 85Questions: 15Answers: 0

When setting the searchBuilderTitle, I would like to be able to essentially take the "default" value for the column title -- and prepend some extra text. Is there a way to initialize this with some kind of callback to effect this?
e.g.

   columns: [
      {
          searchBuilderTitle: 'Prepend Me: ' +    ...default title from <th>...
      }
   ]

Answers

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    Hi Lisa,

    No I'm afraid there isn't - the columns.searchBuilderTitle option is just a straight replacement for the original title.

    How is your table defined? Would reading the value from the document be a valid way of doing this for you? e.g.

    columns: [ {
      searchBuilderTitle: 'Prepend Me: ' + $('#myTable thead th').eq(0).text()
    } ]
    

    Regards,
    Allan

  • lisarushlisarush Posts: 85Questions: 15Answers: 0

    Yes, I could do it that way. It just gets complicated & ugly, as we build our tables very dynamically. Having a way to do a callback, or even just a searchBuilderTitlePrefix option would be great.

    We often use multi-level headers, where the bottom-level <th> cell contents are not enough to differentiate which column you're trying to select. So, I'd like to build the name using "level1 text - level2 text - level3 text". Or, maybe that's even something you could consider doing automatically (or as an option)?

    Simplified header example:

       <thead>
       <tr>
          <th rowspan="3">Name</th>
          <th colspan="10">Data</th>
       </tr>
       <tr>
          <th colspan="2">Q1 2022</th>
          <th colspan="2">Q4 2021</th>
          <th colspan="2">Q3 2021</th>
          <th colspan="2">Q2 2021</th>
          <th colspan="2">Q1 2021</th>
       </tr>
       <tr>
          <th>Max</th>
          <th>Min</th>
          <th>Max</th>
          <th>Min</th>
          <th>Max</th>
          <th>Min</th>
          <th>Max</th>
          <th>Min</th>
          <th>Max</th>
          <th>Min</th>
       </tr>
       </thead>
    

    where we'd want the SearchBuilder select to list:
    Data - Q1 2022 - Max
    Data - Q1 2022 - Min
    etc.

Sign In or Register to comment.