How to hide a column in ABjqGrid by program

Board index English forum Desktop components for HTML5 Builder ABjqGrid for HTML5 Builder

Forum name: ABjqGrid for HTML5 Builder
Description: Grid component for HTML5 Builder
DBGrid for HTML5 Builder,DBTreeGrid for HTML5 Builder. Master-detail mode,subgrid mode.

Post a reply


Enter the code exactly as it appears. All letters are case insensitive.
Confirmation code
:hi: :smile: :wink: :twisted: :sad: :evil: :smoke: :eh: :eek: :fie: :silenced: :razz: :oops: :help: :spy: :insane: :biggrin: :toothless: :ill: :nervious: :weirdface: :pray: :clap: :think: :boxing: :cyclop: :rambo: :zombie: :cry: View more smilies
   

Expand view Topic review: How to hide a column in ABjqGrid by program

Download ABjqGrid

Post by Nataliya » 22.04.2015, 22:54

I'd like to try ABjqGrid for HTML5 Builder. Can I download a trial version? If can then where?
Help please!

Post by wschrabi » 06.03.2015, 19:27

No its a real project to our website. Its easy for you its just to display the MYSQL DB contents in an iframe.
Now it works, thank you very much for your support.
:clap:

Post by admin » 06.03.2015, 19:11

OK.
You make a real project or until just learning to work in IDE?

Post by wschrabi » 06.03.2015, 19:10

my fault. I did not use the Fieldname but the Caption name.
Now it works fine
thanks
:clap:

Post by admin » 06.03.2015, 18:49

Perhaps the script tries to perform a subtraction operation.
Try rename to "GHS_A" in the database and the editor columns (and in programm code).

Post by wschrabi » 06.03.2015, 18:25

yes you are complete right! BUt why does the IMAGE not work?
My column name is "GHS-A" as in the table headline.
What is wrong with it?

Post by admin » 06.03.2015, 17:52

Check the name of the column.

P.S. For what purpose do you reload the net after hiding the column?

P.S2 Regardless of the state of the checkbox you assign the same value caption. Why? :eek: You can set value in design-time.

P.S3 I think this code would be better.
Code: Select all
    function Button1Click($sender, $params)
    {
//        $this->CheckBox1->Caption = "Verstecke GHS Icons in Tab.";  // You can set value in design-time

        $lang=get_languages('data');
        $lang=$lang[0][1];


        $a=$this->ABjqGrid1->Columns;
        $columns['de'][11]['Hidden']=$columns['de'][12]['Hidden']=$columns['de'][13]['Hidden']=$columns['de'][14]['Hidden']=$this->CheckBox1->Checked;
        $c=$columns[$lang];
   
        foreach($c as $key=>$value)   $a[$key]['Hidden']=$c[$key]['Hidden'];

        // set columns
        $this->ABjqGrid1->Columns=$a;

}

Post by wschrabi » 06.03.2015, 00:54

THANK A LOT!!!! :clap:

Added after 2 hours 31 minute:
Admin,
I tried
Code: Select all
    function CheckBox1JSClick($sender, $params)
    {
        ?>
        //begin js

        if (document.getElementById('CheckBox1').checked)
        {

            $ABjqGrid1.jqGrid("hideCol","RecID").trigger("reloadGrid"); // works fine
            $ABjqGrid1.jqGrid("hideCol","GHS-A").trigger("reloadGrid"); // does not work , column is an IMAGE!


        } else
        {
            $ABjqGrid1.jqGrid("showCol","RecID").trigger("reloadGrid"); // works fine
            $ABjqGrid1.jqGrid("showCol","GHS-A").trigger("reloadGrid"); // does not work , column is an IMAGE!
        }

        //end
        <?php
    }

The IMAGE Column does not hide. ON Startup I show the image and I can not hide with javascript. :help:
When I make a php routine it work also on the Image column.

Code: Select all
    function Button1Click($sender, $params)
    {
        if ($this->CheckBox1->Checked)
        {
        $this->CheckBox1->Caption = "Verstecke GHS Icons in Tab.";

        $lang=get_languages('data');
        $lang=$lang[0][1];

        // get columns
        $a=$this->ABjqGrid1->Columns;
        $columns['de'][11]['Hidden']=true;
        $columns['de'][12]['Hidden']=true;
        $columns['de'][13]['Hidden']=true;
        $columns['de'][14]['Hidden']=true;
        $c=$columns[$lang];
        foreach($c as $key=>$value)   $a[$key]['Hidden']=$c[$key]['Hidden'];
        // set columns
        $this->ABjqGrid1->Columns=$a;
        }
    else
        {
        $this->CheckBox1->Caption = "Verstecke GHS Icons in Tab.";

        $lang=get_languages('data');
        $lang=$lang[0][1];

        // get columns
        $a=$this->ABjqGrid1->Columns;
        $columns['de'][11]['Hidden']=false;
        $columns['de'][12]['Hidden']=false;
        $columns['de'][13]['Hidden']=false;
        $columns['de'][14]['Hidden']=false;
        $c=$columns[$lang];
        foreach($c as $key=>$value)   $a[$key]['Hidden']=$c[$key]['Hidden'];
        // set columns
        $this->ABjqGrid1->Columns=$a;
        }
}

Post by admin » 06.03.2015, 00:10

Please see here http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
Example for JS
Hide
$ABjqGrid1.jqGrid('hideCol',["id","CustName"]);

Show
$ABjqGrid1.jqGrid('showCol',["id","CustName"]);

Post by wschrabi » 05.03.2015, 16:37

thanks a lot, now it works.

Post by admin » 05.03.2015, 16:22

Hello!

The first index of the array must be a number. (The column number in the editor columns. It starts with 0)

How to hide a column in ABjqGrid by program

Post by wschrabi » 05.03.2015, 15:51

HI,
How can I set the Property Hidden to TRUE for a Column named GHS-A in ABjqGrid by PHP automatically?
this does not work:
Code: Select all
$this->ABjqGrid1->Columns['GHS-A']['Hidden']=false;
thanks
walter
cron