Welcome Guest Search | Active Topics | Sign In | Register

Problem sorting a column in EO Grid Options
Pablo.Fra
Posted: Tuesday, September 1, 2009 11:59:09 AM
Rank: Newbie
Groups: Member

Joined: 5/27/2009
Posts: 9
Hi,

We have a E.O Web Grid (2009 version) with 1500 rows, when i sort by one of then the IExplorer show me alerts about the execution of the script. I think it's a problem of performance.

How can I solve this problem?

Thanks.
eo_support
Posted: Tuesday, September 1, 2009 12:36:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

What is the column data type?

Thanks!
Pablo.Fra
Posted: Wednesday, September 2, 2009 2:32:10 AM
Rank: Newbie
Groups: Member

Joined: 5/27/2009
Posts: 9
Is a StaticColumn with the AllowSort flag=TRUE.
In this column I load strings (html). For example:
<span style='font-weight:bold;color:red'>Invalid</span>

Thanks.

eo_support
Posted: Wednesday, September 2, 2009 11:20:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Just to let you know that we are still working on this one.

Thanks!
eo_support
Posted: Wednesday, September 2, 2009 12:01:54 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We tested it on the latest version and it can sort about 5000 rows less than a second with no problems. However it does give a "busy" message when we increased the row number to 10000.

So please check whether your have the latest version first. If you already have it, you may want to consider enable paging and do the sorting on the server side. Client side sorting is done by calling string.localeCompare. Since it is a built-in function, there is very little we can do to make it faster.

Thanks!
Pablo.Fra
Posted: Thursday, September 3, 2009 2:07:43 AM
Rank: Newbie
Groups: Member

Joined: 5/27/2009
Posts: 9
Hello,

I'm sure we have the last version because we purchased two months ago. When u say "5000 rows less than a second" is sorting on client side?

Thanks.
eo_support
Posted: Thursday, September 3, 2009 8:41:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Yes. It's sorting on the client side.
Pablo.Fra
Posted: Thursday, September 3, 2009 9:17:57 AM
Rank: Newbie
Groups: Member

Joined: 5/27/2009
Posts: 9
Umm.strange.

1.- ¿The javascript alert message in IExplorer is displayed?

2.- Could u send me the colums properties of your test?

Thanks
eo_support
Posted: Thursday, September 3, 2009 5:05:35 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Here is our test code:

Code: HTML/ASPX
<eo:Grid ID="Grid1" runat="server" Width="380px" 
    Height="200px" BorderColor="#828790" BorderWidth="1px" 
    ColumnHeaderAscImage="00050204" ColumnHeaderDescImage="00050205" 
    ColumnHeaderDividerImage="00050203" ColumnHeaderHeight="24" 
    FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Tahoma" 
    Font-Overline="False" Font-Size="8.75pt" Font-Strikeout="False" 
    Font-Underline="False" GridLineColor="240, 240, 240" GridLines="Both" 
    ItemHeight="19">
    <FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
    <ItemStyles>
        <eo:GridItemStyleSet>
            <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;" />
        </eo:GridItemStyleSet>
    </ItemStyles>
    <ColumnTemplates>
        <eo:TextBoxColumn>
            <TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
        </eo:TextBoxColumn>
        <eo:DateTimeColumn>
            <DatePicker ControlSkinID="None" DayCellHeight="16" DayCellWidth="19" 
                DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" 
                SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" 
                TitleRightArrowImageUrl="DefaultSubMenuIcon">
                <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
                <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                <PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
                <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
                <TitleArrowStyle CssText="cursor:hand" />
                <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
                <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
                <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
                <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
                <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
            </DatePicker>
        </eo:DateTimeColumn>
        <eo:MaskedEditColumn>
            <MaskedEdit ControlSkinID="None" 
                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;">
            </MaskedEdit>
        </eo:MaskedEditColumn>
    </ColumnTemplates>
    <ColumnHeaderHoverStyle CssText="background-image:url('00050202');padding-left:8px;padding-top:4px;" />
    <Columns>
        <eo:StaticColumn DataField="name" HeaderText="Name" AllowSort="True">
        </eo:StaticColumn>
    </Columns>
    <ColumnHeaderStyle CssText="background-image:url('00050201');padding-left:8px;padding-top:4px;" />
</eo:Grid>


Code: C#
public class test
{
    private string m_szName;
    private static Random m_Random = new Random();

    public string name
    {
        get 
        {
            //IMPORTANT: Modify the following line from "&lt;div" to "&lt;div"
            return string.Format("&lt;div style='color:red'&gt;{0}&lt;/div&gt;", m_Random.Next());
        }
        set { m_szName = value; }
    }
}

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        ArrayList tests = new ArrayList();
        for (int i = 1; i < 5000; i++)
        {
            test t = new test();
            t.name = i.ToString();
            tests.Add(t);
        }
        Grid1.DataSource = tests;
        Grid1.DataBind();
    }
}


This code does not display the JavaScript alert message.

Thanks!
Pablo.Fra
Posted: Friday, September 4, 2009 3:16:18 AM
Rank: Newbie
Groups: Member

Joined: 5/27/2009
Posts: 9
Hi,

Thanks, I have tried your code and works fine. But if you change the line

return string.Format("&lt;div style='color:red'>{0}</div>", m_Random.Next());

by

return string.Format("&lt;div style='color:red'>{0}</div>", 555);

You'll see that does not work well. I think that when there are many repeated data the sorting algorithm is very slow. In my case I have only two different values in the 1500 rows and probably this is the problem.

Thanks for everything

eo_support
Posted: Friday, September 4, 2009 8:10:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

In that case you might want to add a second "key" to your data. For example, change it to

string.Format("<div style='color:red'><span style='display:none'>{0}</span>{1}</div>", record_id, 555);

It added an additional invisible segment "<span style='display:none'>{0}</span>". This segment is different for every record but does not change what you see.

Thanks!
Pablo.Fra
Posted: Friday, September 4, 2009 8:59:54 AM
Rank: Newbie
Groups: Member

Joined: 5/27/2009
Posts: 9
Good solution, now works fine!

Thanks u
eo_support
Posted: Friday, September 4, 2009 9:12:21 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Glad that it works for you!


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.