Current filter:
                                You should refresh the page.
                                  • Description:
                                    I would like to add a Check column to my View to allow users to select records. I do not need to store the values of this column in the underlying table and thus, I do not want to add an extra field to the table's structure. Does your Grid allow such a column?

                                    Answer:
                                    The new ExpressQuantumGrid 5 supports this functionality and allows you to set such an unbound column (row - for a Card View). Here are the necessary steps (the code snippets will illustrate how to perform the same operations programmatically):

                                    1. IMPORTANT. This feature requires the Data Controller to be in the following settings:
                                    - default data loading mode - make sure to set the Data Controller's DataModeController.GridMode property to False
                                    [Delphi]
                                    <aView>.DataController.DataModeController.GridMode := False;

                                    - Smart Refresh mode - set the Data Controller's DataModeController.SmartRefresh property to True

                                    [Delphi]
                                    <aView>.DataController.DataModeController.SmartRefresh := True;

                                    - key field(s) - you must initialize the Data Controller's KeyFieldNames property

                                    [Delphi]
                                    <aView>.DataController.KeyFieldNames := 'aUniqueField';
                                    2. Add a new column to a View. Do not initialize its DataBinding.FieldName property.
                                    [Delphi]
                                    var aCol: TcxGridDBColumn; ... aCol := <aView>.CreateColumn; with aCol do begin Name := 'colUnbound'; Caption := 'Check'; end;
                                    3. Set the column's DataBinding.ValueType to an appropriate value. This property specifies the string representation of the data type which the data binding provides. For example, if you wish the column to store logical values, set the DataBinding.ValueType property to Boolean.
                                    [Delphi]
                                    uses cxDataStorage; ... aCol.DataBinding.ValueTypeClass := TcxBooleanValueType;

                                    NOTE: When setting the value type programmatically, you should refer to the DataBinding.ValueTypeClass property instead and use the corresponding value type class.
                                    4. Bind an appropriate editor to the column. Set the column's Properties property to the necessary value (CheckBox in our instance).

                                    [Delphi]
                                    uses cxCheckBox; ... aCol.PropertiesClass := TcxCheckBoxProperties; //OR aCol.PropertiesClassName := 'TcxCheckBoxProperties';

                                    NOTE: When setting the Properties property value programmatically, you should refer to the item's PropertiesClass or PropertiesClassName property instead and use the corresponding properties type class.
                                    5. Adjust the column Properties' settings as your need dictate. For example, set the ValueChecked and ValueUnchecked properties to the values used in your application:

                                    [Delphi]
                                    with aCol.Properties as TcxCheckBoxProperties do begin AllowGrayed := False; ValueChecked := True; ValueUnchecked := False; end;

                                    That's all. Now, you can modify the values of the newly added column and refer to them using the standard methods of the ExpressDataController.
                                    Important Note: The described approach is not suitable for unbound columns in the detail view of the Master-detail model because the DataModeController.SmartRefresh property contradicts the detail DataSet refresh procedures.
                                    See also:
                                    How to implement unbound checkboxes in a bound View
                                    How to display an image from a data table in an Unbound View
                                    How to show a row number value in an unbound Grid column
                                    How to set an item's Properties at runtime

                                Show all comments
                                • Nico F. 07.15.2013

                                  Hi,
                                     Is this still working in VCL Version 12.2.5 ? I cannot achieve editing an unbound column.
                                  Thanks in advance for your answer.

                                • Nico F. 07.15.2013

                                  I mean, in a DBTable View

                                • Serge (DevExpress Support) 07.15.2013

                                  Hello Nico,
                                  To process your inquiry more efficiently, I have created a separate ticket on your behalf: Q377298: How to set up an unbound item in a data-aware View.

                                • Scott van der Linden 11.09.2014

                                  What is the workaround for your disclaimer that SmartRefresh cannot be used in detail datasets?  How do I store calculated values in cells of unbound detail tables?
                                  Note: I could use an InternalCalc field to do this, however it only updates the data on post - I need the data update when a value is edited (at least at the point where a cell value is edited).  Note: I was using OnGetDisplayText however I can't get a total from that.

                                • Vladimir Ulchenko 11.09.2014

                                  InternalCalc field is the way to go, just set up corresponding checkbox editor to immediately post modified value into dataset as soon as it is (un-)checked

                                • Paulo (DevExpress Support) 11.10.2014

                                  Vladimir is absolutely right. If you force your in-place editor to update data immediately, the InternalCalc field will be calculated right after you modify an editor value.

                                • Luis Antonio Gama Moreno 06.23.2015

                                  Hello, I'm trying to create the unbound checkbox at runtime after open the dataset. My problem is that I create the DataSet at runtime when the user open an Excel File, so the dataset is created with the Excel's columns structure. I followed all the steps in this ticket but it doesn't work, also I need the checkbox as the first column. Attached is the project, hope you can help me.
                                  Thanks

                                • Franky Brandt 06.23.2015

                                  Luis, i have tried your project.
                                  I think it comes down to 2 issues, first of all make sure to set the keyfieldnames to the view.datacontroller and secondly the 'editing' flag in your view's OptionData properties is set to False.
                                  You can not check the checkboxes because of setting the Editing option to false, so the solution is to enable editing in your view properties Optionsdata.
                                  If you want the other columns to be readonly set them to readonly individually in runtime after you created the columns (before creating the checkbox column)

                                • Paulo (DevExpress Support) 06.24.2015

                                  Hello,

                                  Franky is absolutely right. I see that you set the grdTableView.DataController.KeyFieldNames property to 'aUniqueField' in your project. However, there is no such a field in your underlying DataSet. To make unbound columns work OK, you need to have a unique key field in your database. Otherwise, in SmartRefresh mode, there will be no way to identify a certain record.
                                  As for your question about the checkbox column, you can use the Index property to change the column's position:

                                  [Delphi]
                                  aCol.Index := 0;
                                • Klemen Hrovat 09.07.2017

                                  Hi,

                                  How can I then access which checkbox was changed/clicked and its value (true/false)?

                                  Regards

                                • Mikhail (DevExpress Support) 09.07.2017

                                  Hello Klemen,

                                  I've created a separate ticket on your behalf (T553081: How can I access which checkbox was changed/clicked in an unblund column and get its value (true/false)?). It has been placed in our processing queue and will be answered shortly.

                                0 Solutions

                                Creation Date Importance Sort by