Hi,

I want to create a table in Perl Tk, that will support sort and filtering.

Currently I implemented the table using Tk::Table. This is the table code:
my @lines = (<Tab>); chomp(@lines); close(Tab); my @tmp = (split(/;/,$lines[0])); my $colu = ($#tmp) +2; my $ro = ($#lines+2); $table->destroy if ($table); $table = $TFrame->Table(-rows=>$ro, -columns=>$colu, - +scrollbars=>'se', -fixedrows=>2, -relief=>'raised')->pack(-side=>'top +',-anchor=>'nw'); my $r =1; my @Approved =0; foreach my $row (@lines) { my $tmp_l; if ($r>1) { my $data = $r -1; $tmp_l = $table->Label(-text=>$data, -anchor=> +'w', %Entry_color, -relief=>"groove"); $table->put($r, 1, $tmp_l); } else { $tmp_l = $table->Label(-text=>"Entry", -anchor +=>'w',-background=>'gray', -relief=>"raised"); $table->put($r, 1, $tmp_l); } my $c=2; my @data = (split(/;/,$row)); while ($c <= $colu) { if ($data[$c-2]) { $file_Contant[$r-1][$c-2]=$data[$c-2] ; } else { $file_Contant[$r-1][$c-2]=""; } my $tmp_label; if ($r==1) { $tmp_label = $table->Label(-text=>$data[$c +-2], -anchor=>'w',-background=>'gray', -relief=>"raised") ; + } $tmp_label = $table->Entry(-textvariable => \$ +file_Contant[$r-1][$c-2], -width=> 15,%Entry_color, -relief=>"groove" +) if ($r>1); $table->put($r, $c, $tmp_label); $c++; } $r++; } $table->pack(-fill=>'both',-side=>'top',-anchor=>'nw', +-expand=>1); return($table,\@file_Contant) }

I want to create filtering according to columns.


In reply to Re^2: Tk::Table hide? by Ohad
in thread Tk::Table hide? by Ohad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.