Ticket CQ63737
Visible to All Users

Hide columns in NewItemRow

created 18 years ago

Hi,
I'm creating a simple UI for a small program and have some issues.

  1. I wish to use te NewItemRow for quick inserts.
  2. I wanted the user to be able to double click any of the rows in the grid to open up an edit window. To accomplish this i have to make the grid read-only thus the NewItemRow dont work.
    Instead, i've added a column with a imagecombobox lookup and added some buttons that i handle when clicked. I do not wish these to be visible in the NewItemRow, and tried overriding the ShowingEditor event, but this only solves the problem halfways. It is still visible when the column has focus.
    Can I accomplish this any way?
Show previous comments (2)
DevExpress Support Team 18 years ago

    Hi Stefan,
    To implement row editing in a separate form invoked on row double-click, please try the solution used in the GridEditDataInPopupForm module of the GridTutorials project shipped with the suite.
    I'm afraid it is impossible to designate rows just added to the grid via the NewItemRow from others. When a row is updated, or added to a datasource, the GridView.RowUpdated event fires. You can handle this event, and check if the row property that isn't listed in grid columns isn't initialized, and show the popup form.
    I'm looking forward to hearing from you.
    Thanks,
    Michael.

      Hi Michael,
      The code sample implies double-clicking on the row-indicator OR in a row if the grid is set to read only. The problem however is being able to use the NewItemRow if it's read-only.
      In the RowUpdated event i checked if the RowHandle was < 0 since the IsNewItemRow function does not return true. I think this solution is correct.

      DevExpress Support Team 18 years ago

        Hi Stefan,
        To disable editing all rows except the NewItemRow, make the view editable, and handle the GridView.ShowingEditor event in the following way:
                void gridView1_ShowingEditor(object sender, CancelEventArgs e)
                {
                    GridView view = sender as GridView;
                    if (!view.IsNewItemRow(view.FocusedRowHandle))
                        e.Cancel = true;
                }
        As for checking the RowHandle<0 condition in the RowUpdated event, the NewItemRow handle will never be passed, because when a row is updated it gains a normal handle. We still recommend that you use a special field for this purpose, which can be initialized only in a popup form.
        Thanks,
        Michael.

        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.