Custom searchPanes PreSelect?

Custom searchPanes PreSelect?

s-gs-g Posts: 4Questions: 2Answers: 0

Hi,

is it possible to preSelect one value from a custom searchPane?

  • The searchPane is opened inside a modal, through a custom button.
  • serverSide: false

Thank you

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Yep, you can use searchPanes.preSelect for that - please see working demo here,

    Colin

  • s-gs-g Posts: 4Questions: 2Answers: 0

    Hi Colin,

    thanks, that works for most panes/columns. However, I am not sure I can use this for preSelecting a custom pane that includes data from two different columns:

        panes: [
                     {
                       header: 'PT',
                       options: [
                              {
                                  label: 'LEEGOO != HPL',
                                  value: function (rowData, rowIdx) {
    
                                  var HPL_Proposal = rowData['HPL_Proposal'];
                                  var Proposal_Type = rowData['Proposal_Type'];
    
                                    return Proposal_Type != HPL_Proposal;
                                },          
                              },
                              {
                                 label: 'Quotation',
                                 value: function (rowData, rowIdx) {                                       
                                     return rowData['Proposal_Type']  === '001';
                                },  
                               },
                              {
                                  label: 'lost',
                                  value: function (rowData, rowIdx) {                                       
                                           return rowData['Proposal_Type']  === '004';
                                   },  
                               }
                             ],
                           }
    
    • 'panes' is inside the config of the extended searchPanes

    Would it be possible to preSelect this custom pane by choosing the searchPane index instead of the table column?

    Thanks

  • allanallan Posts: 63,441Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Hi,

    I think the last paragraph in the searchPanes.preSelect is what you are looking for. In particular:

    To make preselections in custom panes, the searchPanes.preSelect.column value should be set to the sum of the last column's index, and the number of custom pane this is.

    I will straight up say that it is non-intuitive that. I will be looking at refactoring that in future.

    Allan

  • s-gs-g Posts: 4Questions: 2Answers: 0
    edited January 22

    Hi Allan,

    my bad, didn't see that part. Modified it and it works now.

    Thanks!

Sign In or Register to comment.