Add filter option to table. I have to filter variable "cab1" based on alphabets and then select.

Jouher_20929
Jouher_20929 Altair Community Member
edited October 2020 in Community Q&A

Answers

  • tinh
    tinh Altair Community Member
    edited July 2018

    Hi

    the code is like this:

     

    ....

    $recess.sl rowadd row$I -values  [list entities ...

    lappend ::FullTable [list entities ...

    incr I

    }

     

    button $w.bFilter -text Filter -command {::texample::p_Filter [::hwtk::inputdialog -title Filter -text Filter]}

    pack $w.bFilter

    proc ::texample::p_Filter {Filter {Index 1}} {

       if {![string equal '' $Filter]} {

          if {[string first * $Filter]==-1} {append Filter *}

          set NewList [lsearch -glob -nocase -all -inline -index $Index $::FullTable $Filter]

       } else {

          set NewList $::FullTable

       }

       foreach row [$::recess.sl rowlist] {$::recess.sl rowdelete $row}

       foreach row $NewList {

          $::recess.sl rowadd row[incr i] -values $row

       }

    }

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited July 2018

    @tinh

    WHere i sould add this to my above code

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited July 2018

    image.png.36f6149145801d5fe77a526f76ffbd23.pngimage.png.8c655e0990bb1b85263fa718f9721e28.png

  • tinh
    tinh Altair Community Member
    edited July 2018

    I edited again the code. see above

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2018

    chua mot cot

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited August 2018

    @tinh Its working. Thanks for this. 

    But I want it in a different way. 

    That is, I can select from checklist + when I filter and select = Total check

    That is , when I filter list should come as filter and will get selected , then comes without filter with selected....like appending and refreshing

  • tinh
    tinh Altair Community Member
    edited August 2018

    Can you do it base on my code?

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited August 2018

    Can you do it base on my code?

    I was working on your code, but did not figure out to do this.

  • tinh
    tinh Altair Community Member
    edited August 2018

    I dont know how to answer because your question is not detail, so it seems that i write all script for you and finally it is ... not what you want! Very time consuming. So just devide your work to smaller tasks...

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited August 2018

    @tinh you have wrongly taken. Your script is ok. What i want is when I filter and select, the selections should append to previous selections and come back for full selection

  • tinh
    tinh Altair Community Member
    edited August 2018

    It does not have a method to hide rows

    So once we delete rows (to show again filtered ones), last selection was lost

     

    When you filter it, set a global variable ::v_Filtering = 1, when you clear all selection (reset) => set it 0

     

    and in selectcommand proc, use that variable to decide to append or subtract or reset selected variable

     

    Do you understand?