Filterbar and Checkbox-Col

Posted by: ibcesak on 27 September 2017, 8:43 pm EST

    • Post Options:
    • Link

    Posted 27 September 2017, 8:43 pm EST

    I use TDBGrid and have a “String”-column and a “boolean”-column.

    In my filterbar I can click a Checkbox, but there is no filter reaction.

    What do I wrong?

    Thanks Horst

                DataTable mDT = new System.Data.DataTable();
    
                mDT.Columns.Add("PCID", Type.GetType("System.String"));
                mDT.Columns.Add("ASZ", Type.GetType("System.Boolean"));
               
    
                //-------------------------------------------------------------------------------
                C1.Win.C1TrueDBGrid.C1DataColumn lcol;
    
    
                lcol = new C1.Win.C1TrueDBGrid.C1DataColumn();
                lcol.DataField = "PCID";                
                lcol.Caption = "ID";                
                GridTests.Columns.Add(lcol);
                GridTests.Splits[0].DisplayColumns[lcol].Visible = true;
                GridTests.Splits[0].DisplayColumns[lcol].Locked = true;
                 
    
                lcol = new C1.Win.C1TrueDBGrid.C1DataColumn();
                lcol.DataField = "ASZ";
                lcol.Caption = "ASZ";
                lcol.ValueItems.Translate = true;
                lcol.ValueItems.CycleOnClick = false;
                lcol.ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox;                
                GridTests.Columns.Add(lcol);
                GridTests.Splits[0].DisplayColumns[lcol].Visible = true;
                GridTests.Splits[0].DisplayColumns[lcol].Locked = true;
    
  • Posted 27 September 2017, 8:43 pm EST

    Hello,

    I am sorry to mention but I was unable to replicate the mentioned issue at my end. I was able to filter the grid from the FilterDropDown. Please refer the attached video and sample for the same.

    I request you to please modify the attached sample such that it produces the issue so that we may replicate the same at our end and hence assist you further.

    Regards,

    Ankita

    2015/02/C1TDBG_FilterIssue.zip

    2015/02/C1TrueDBGrid_Filter.gif

  • Posted 27 September 2017, 8:43 pm EST

    Hi Ankita,

    Thank you for your soon answer.

    I do no use a FilterDropDown - I want to use the filterbar.

    Regards

    Horst

  • Posted 27 September 2017, 8:43 pm EST

    Hello,

    Please refer the attached sample in which the filtering is performed by changing the checked state of the CheckBox in the Filter Bar. The sample is created using the provide code and it is working fine at our end. Please refer the attached gif for the same.

    In case the sample still doesn’t help, then please modify the attached sample such that it produces the issue so that we may replicate the same at our end as it would be difficult for us to provide you with the best solution without replicating the issue.

    Regards,

    Ankita

    2015/02/C1TDBG_FilterIssue_Modified.zip

    2015/02/FilterCheck.gif

  • Posted 27 September 2017, 8:43 pm EST

    Hi Ankita,

    thank you für your example - it runs.

    The difference was:

    My Code: GridTests.SetDataBinding(mDT, “”, true);

    Your Code: GridTests.DataSource = mDT;

    Can you tell my, why my code to not work?

    Thanks again,

    Horst

  • Posted 27 September 2017, 8:43 pm EST

    Hello,

    Please try using this code. This should solve your issue with the ‘SetDataBinding’ method:

    [csharp]private void Form1_Load(object sender, EventArgs e)

    {

    DataTable mDT = new System.Data.DataTable();

            mDT.Columns.Add("PCID", Type.GetType("System.String"));
            mDT.Columns.Add("ASZ", Type.GetType("System.Boolean"));
            mDT.Rows.Add("Value 1", true);
            mDT.Rows.Add("Value 2", false);
            mDT.Rows.Add("Value 3", false);
            mDT.Rows.Add("Value 4", false);
            mDT.Rows.Add("Value 5", false);
            mDT.Rows.Add("Value 6", true);
            mDT.Rows.Add("Value 7", true);
            mDT.Rows.Add("Value 8", true);
            GridTests.AllowAddNew = true;
     
            C1.Win.C1TrueDBGrid.C1DataColumn lcol;
    
            lcol = new C1.Win.C1TrueDBGrid.C1DataColumn();
            lcol.DataField = "PCID";
            lcol.Caption = "ID";
            GridTests.Columns.Add(lcol);
            GridTests.Splits[0].DisplayColumns[0].Visible = true;
            GridTests.Splits[0].DisplayColumns[0].Locked = true;
    
            lcol = new C1.Win.C1TrueDBGrid.C1DataColumn();
            lcol.DataField = "ASZ";
            lcol.Caption = "ASZ";
            lcol.ValueItems.Translate = true;
            lcol.ValueItems.Values.Add(new C1.Win.C1TrueDBGrid.ValueItem("true", true));
            lcol.ValueItems.Values.Add(new C1.Win.C1TrueDBGrid.ValueItem("false", false));
            lcol.ValueItems.CycleOnClick = false;
            lcol.ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox;
            GridTests.Columns.Add(lcol);
            GridTests.Splits[0].DisplayColumns[1].Visible = true;
            GridTests.Splits[0].DisplayColumns[1].Locked = true;
            GridTests.SetDataBinding(mDT, "",true);
            GridTests.AllowFilter = true;
            GridTests.FilterBar = true;
        }[/csharp]
    

    Hope it helps.

    Regards,

    Ankita

  • Posted 26 October 2017, 7:42 am EST

    Hi;

    What if we have decided to create our own filter method;

    How can we filter checkbox items??

    a little code I know I have the same problem on Datetime :frowning:

    Please give a little trick to handle these issuees

    Thanks…

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels