Welcome Guest Search | Active Topics | Sign In | Register

Grid getItemCount vs getRecordCount Options
Brad Coble
Posted: Tuesday, January 27, 2009 8:04:54 AM
Rank: Member
Groups: Member

Joined: 12/17/2008
Posts: 16
Hi!

In your documentation you say that when a grid is set to allow paging that the getItemCount should return the number of records on the curent page. When I do it, both record and item count return the same value.

The reason I need them to return what the docs say is when a user presses the down arrow key, the selected cell keeps going into the next page. I want to be able to automatically move to the next page when this happens. I think if these 2 items returned there correct value i can calculate the proper page to set.

Thanks!!

Code: HTML/ASPX
<eo:Grid ID="Grid1" runat="server" BorderColor="#C7D1DF" BorderWidth="0px" ColumnHeaderAscImage="00050303"
            ColumnHeaderDescImage="00050304" ColumnHeaderDividerImage="00050302" Font-Bold="False"
            Font-Italic="False" Font-Names="Verdana" Font-Overline="False" Font-Size="9pt"
            Font-Strikeout="False" Font-Underline="False" GridLineColor="199, 209, 223" GridLines="Both"
            Height="510px" ItemHeight="23" Width="100" FullRowMode="False" EnableKeyboardNavigation="True"
            DataTable="row" ClientSideOnCellSelected="clientside_generic_handler" AllowColumnReorder="False" AllowNewItem="True" AllowPaging="True">
            <ItemStyles>
                <eo:GridItemStyleSet>
                    <AlternatingItemStyle CssText="background-color: #F7F7DE" />
                    <AlternatingItemHoverStyle CssText="background-color: #F7F7DE" />
                    <ItemStyle CssText="background-color: white" />
<%--                    <ItemHoverStyle CssText="background-image: url(00050206); background-repeat: repeat-x" /><SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
--%>                    
                    <CellStyle CssText="padding-left:8px;padding-top:2px; white-space:nowrap;" />
                    <SelectedStyle CssText="color:#ffffff;background-image: url('../App_Themes/default/mItemBack.png'); background-repeat: repeat-x" />
                </eo:GridItemStyleSet>
            </ItemStyles>
            <ColumnHeaderStyle CssText="background-color:#6B696B;padding-left:8px;padding-top:2px;font-weight: bold;color:white;height:23px" />
            <ContentPaneStyle CssText="text-align: left" />
            <FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
            <Columns>
                <eo:CustomColumn ClientSideGetText="on_get_text" ClientSideBeginEdit="on_begin_edit"
                    ClientSideEndEdit="on_end_edit" DataField="col1" HeaderText="Body Number" AllowResize="true" AllowSort="True">
                    <EditorTemplate>
                        <eo:MaskedEdit runat="server" ID="me0" Width="92" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;"
                            ClientSideOnLoad="test_handler">
                            <eo:MaskedEditSegment SegmentType="Number" Text="        " />
                        </eo:MaskedEdit>
                    </EditorTemplate>
                </eo:CustomColumn>
                <eo:CustomColumn ClientSideGetText="on_get_text" ClientSideBeginEdit="on_begin_edit"
                    ClientSideEndEdit="on_end_edit" DataField="col2" HeaderText="Robot Code" AllowResize="true" AllowSort="True">
                    <EditorTemplate>
                        <eo:MaskedEdit runat="server" ID="me1" Width="92" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
                            <eo:MaskedEditSegment SegmentType="Number" Text="        " />
                        </eo:MaskedEdit>
                    </EditorTemplate>
                </eo:CustomColumn>
                <eo:CustomColumn ClientSideGetText="on_get_text" ClientSideBeginEdit="on_begin_edit"
                    ClientSideEndEdit="on_end_edit" DataField="col3" HeaderText="Length" AllowResize="true" AllowSort="True">
                    <EditorTemplate>
                        <eo:MaskedEdit runat="server" ID="me2" Width="92" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;">
                            <eo:MaskedEditSegment SegmentType="Number" Text="        " />
                        </eo:MaskedEdit>
                    </EditorTemplate>
                </eo:CustomColumn>
            </Columns>
        </eo:Grid>


Code: JavaScript
function clientside_generic_handler(sender) {
            Debug.writeln(sender.getItemCount());
            Debug.writeln(sender.getRecordCount());
            Debug.writeln(sender.getSelectedCell().getItemIndex());            
        }


Code: C#
protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds = new DataSet("myds");
        ds.Tables.Add("row");
        ds.Tables["row"].Columns.Add("col1", Type.GetType("System.Int32"));
        ds.Tables["row"].Columns.Add("col2");
        ds.Tables["row"].Columns.Add("col3");

        for (int i = 1; i <= 29; i++)
        {
            DataRow newRow = ds.Tables["row"].NewRow();
            newRow["col1"] = i;
            newRow["col2"] = i.ToString();
            newRow["col3"] = i.ToString();
            ds.Tables["row"].Rows.Add(newRow);
        }

        Grid1.DataSource = ds;
        Grid1.DataBind();
    }
eo_support
Posted: Tuesday, January 27, 2009 9:15:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi Brad,

I believe the two are different only when the Grid is running in Server or Callback mode. When the Grid is running on Client mode, everything is already on the client side so both return the same value. We will modify our documentation to clarify this.

The down arrow key seems to be an issue. Obviously the Grid should switch the page automatically. We will get this fixed as soon as possible.

Thanks!
Brad Coble
Posted: Tuesday, January 27, 2009 9:28:57 AM
Rank: Member
Groups: Member

Joined: 12/17/2008
Posts: 16
Thanks for the fast update, like normal you guys are on top of it!

While you are fixing the down arrow issue, it would be nice to go ahead and add something like getPageSize to the client side grid object. Other than the current issue, I cant think of anything to use it for, but who knows!
eo_support
Posted: Tuesday, January 27, 2009 9:33:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Yes. That makes perfect sense. Before we add that function, you might want to hard code it for now since a Grid's page size does not change at runtime.
Brad Coble
Posted: Tuesday, January 27, 2009 10:14:08 AM
Rank: Member
Groups: Member

Joined: 12/17/2008
Posts: 16
Actually I am using grid["aaot"] to retrieve the page size as a work around until it's fixed.

Thanks! And have I told you, you guys are awesome?! :)
eo_support
Posted: Tuesday, January 27, 2009 10:23:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Brad Coble wrote:
Thanks! And have I told you, you guys are awesome?! :)


Yes. You have. :) Thank you very much for that!
eo_support
Posted: Tuesday, February 3, 2009 9:01:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
This has been addressed in build 2008.0.63. Now the Grid should automatically switch pages when you scroll up and down with arrow key. A new getPageSize function has also been added to the client side Grid object.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.