0 is displayed though the value is Null

  1. #1

    0 is displayed though the value is Null

    We have implemented the grid list. The int value seems to be displayed as 0 though the data is null in the database(SQL server).

    Are there any way to not display 0 when null other than changing to string value?
    We are using EXT.net 4.8.3.

    <ext:GridPanel ID="GridPanelA"
        runat="server" ColumnLines="true" TitleCollapse="true"
        Region="Center" EnableColumnMove="false" EnableColumnHide="false">
        <Store>
            <ext:Store ID="StoreId" runat="server" PageSize="20">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="Float1" Type="Float" />
                            <ext:ModelField Name="Float2" Type="Float" />
                            <ext:ModelField Name="Int1" Type="Int" />
                            <ext:ModelField Name="Int2" Type="Int" />
                            <ext:ModelField Name="Int3" Type="Int" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column runat="server" Text="GroupA">
                    <Defaults>
                        <ext:Parameter Name="Sortable" Value="true" />
                        <ext:Parameter Name="Align" Value="Center" />
                    </Defaults>
                    <Columns>
                        <ext:Column runat="server" ID="FloatA" Text="FloatA" DataIndex="Float1" Width="150" />
                        <ext:Column runat="server" ID="FloatB" Text="FloatB" DataIndex="Float2" Width="150" />
                        <ext:Column runat="server" ID="IntA" Text="IntA" DataIndex="Int1" Width="100" />
                        <ext:Column runat="server" ID="IntB" Text="IntB" DataIndex="Int2" Width="100" />
                        <ext:Column runat="server" ID="IntC"Text="IntC"  DataIndex="Int3" Width="120" />
                    </Columns>
                </ext:Column>
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:PagingToolbar runat="server">
            </ext:PagingToolbar>
        </BottomBar>
        <SelectionModel>
            <ext:CheckboxSelectionModel runat="server" Mode="Multi" />
        </SelectionModel>
    </ext:GridPanel>
    Last edited by fabricio.murta; May 25, 2020 at 4:19 PM. Reason: convert attachment into code block
  2. #2
    Hello @mkomiyama, and welcome to Ext.NET!

    Have you tried adding AllowNull="true" to your ext:ModelField lines?

    Here's a discussion that may interest you (although it is related to charts, it involves stores with null values):

    Handle null values as gaps in a Line Chart

    Hope this helps!

    p.s.: please do not attach code samples as .txt files (do not attach at all), add them as code blocks so we can see it; we almost missed your one here.
    Last edited by fabricio.murta; May 25, 2020 at 4:38 PM.
  3. #3

    0 is displayed though the value is Null

    Now we can show blank.
    Thank you for your help.

    Please mark as [CLOSED].

Similar Threads

  1. Replies: 2
    Last Post: Jun 16, 2016, 3:48 PM
  2. Replies: 1
    Last Post: Nov 07, 2013, 2:40 PM
  3. Replies: 0
    Last Post: Dec 01, 2011, 6:43 AM
  4. Replies: 1
    Last Post: Jun 08, 2010, 11:38 AM
  5. Replies: 0
    Last Post: Mar 05, 2010, 3:28 AM

Tags for this Thread

Posting Permissions