Ticket A1095
Visible to All Users

How to set up an unbound item in a data-aware View

created 21 years ago (modified 7 months ago)

Description:
I would like to have a column in my database-aware view for specific purposes, but I do not need to store the values of this column in the underlying table. Thus, I do not want to add an extra field to the database table's structure.

Answer:

If you wish to use this column for selection purposes, you can enable our web-style selection checkboxes.

If you need a generic checkbox column, you can create an empty column, use HitTests to respond to user actions, handle the OnGetDataText or OnCustomDrawCell event to display text, and store values in a separate structure (e.g., an array or a dictionary).

If you need to implement an unbound column with a textbox editor, follow these steps:

Delphi
uses cxDataStorage; ... aCol.DataBinding.ValueTypeClass := TcxStringValueType;

The attached project illustrates the general idea. You need to replace FValues and FStates arrays with your own structure (e.g., based on TDictionary), and manually sort them and add or delete their values when the view's structure is changed. DataController.OnDataChanged may help you detect this change.

See also:
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 previous comments (15)
RK RK
Rolf Klimaschewski 4 years ago

    no, it is "msmStandard"

    RK RK
    Rolf Klimaschewski 4 years ago

      but, it dosn't matter, if it is "msmStandard" or "msmPersistent" - always the same behavior.

      i changed the datamodell an add a DB-Field - that work fine!

        Fair enough, your OptionsSelection needed to be set to

        • multiselectmode msmPersistent
        • UnselectFocusedRecordnExit False

        That should work

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.