Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
AllowAddNew in hierarchical Grid
posted

I have a xamDataGrid that is bound to an IBindingList and is a hierarchy. I want to AllowAddNew on the child rows in the hierarchy but not on the parent rows.

My field layout settings look like this.

                   <igDP:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True" 
                                          AllowFieldMoving="WithinLogicalRow"
                                          SelectionTypeCell="Single" SelectionTypeField="None"
                                          SelectionTypeRecord="Single" AllowDelete="True">

My data grid looks like this

     <igDP:XamDataGrid.FieldLayouts>
                    <igDP:FieldLayout >
                        <igDP:Field Name="OpportunityServiceName" Label="Service">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings AllowEdit="False" />
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="AnnualGrossRevenueAmount" Label="Gross Revenue">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings EditAsType="{x:Type sys:Double}">
                                    <igDP:FieldSettings.EditorStyle>
                                        <Style TargetType="{x:Type igEditors:XamNumericEditor}" >
                                            <Setter Property="Mask" Value="{}{double:11.2}"/>
                                        </Style>
                                    </igDP:FieldSettings.EditorStyle>
                                </igDP:FieldSettings>
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="Lanes" Label="Lanes" />
                    </igDP:FieldLayout>
                    <igDP:FieldLayout  Key="Lanes">
                        <igDP:Field Name="Origin" Label="Origin" />
                        <igDP:Field Name="Destination" Label="Destination" />
                        <igDP:Field Name="LaneID" Visibility="Collapsed"  />
                    </igDP:FieldLayout>
   </igDP:XamDataGrid.FieldLayouts>

The result is my parent rows have an add new row, my child rows do not, which is the opposite of what I want.

Is there a way to apply the AllowAddNew to just child rows?

Parents
  • 27093
    posted

    Hello,

    When you define hierarchical layouts in explicitly the second layout you define is applied to the second level of data. So in order to get the desired behavior you have to set:

    <igDP:Field.Settings>
          <igDP:FieldSettings AllowEdit="False" />
    </igDP:Field.Settings>
    to the second FieldLayout only.

    Please let me know if you require any further clarification on the matter.

    Sincerely,

    Petar Monov

    Developer Support Engineer

    Infragistics Bulgaria

    www.infragistics.com/support

Reply Children