This is a migrated thread and some comments may be shown as answers.

Slow problem when sorting an image column

4 Answers 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
bruno
Top achievements
Rank 1
bruno asked on 17 Sep 2010, 04:05 PM
Hi.

I have a RadGridView with 10.000 rows.
It has 4 columns, 3 string columns and 1 image column.
When i sort the string columns, it works fine(less than 1 second).
But when i sort the image column, it takes to long, took me 25 seconds.
Don't known what order algorithm your using, but it's taking to long.

Think this is a bug report.

Bruno Almeida.

EDIT: Here is one print of my RadGridView looking... Done it while it was ordering the image column (the first one).

PS: If, by mistake, i click 2 or 3 times in the column(to order it) when its processing the first order, it calls the order that many times. making the 25 seconds waiting time in 25*3 = 75 seconds.

4 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 22 Sep 2010, 08:35 PM
Hi bruno,

Thank you for contacting us.
 
We are sorting the image column by the image length. However, this may be a slow operation when there are a lot of rows. You can disable the sorting for this column by setting its AllowSort property to false

I hope this helps.

Kind regards, Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
bruno
Top achievements
Rank 1
answered on 23 Sep 2010, 12:38 PM
Hi Jack!
Thank you for answering.

Actually that is what I am doing. But change AllowSort to false is more a bandage than a solution.
Maybe store the hash of the image (md5 for example) and order by it could be slower. Or make it optionally, order by size or by hash. Just an idea...

Anyway, i am going to keep AllowStort as false.

Kind Regards,

Bruno Almeida
0
Emanuel Varga
Top achievements
Rank 1
answered on 24 Sep 2010, 05:52 AM
Hello bruno,

You should try implementing a custom sort operation for your grid, this might help

private void Form1_Load(object sender, EventArgs e)
        {
            foreach (GridViewDataColumn column in radGridView1.Columns)
            {
                column.CustomDataOperation = CustomDataOperation.Sorting;
            }
 
            radGridView1.CustomSorting += new GridViewCustomSortingEventHandler(radGridView1_CustomSorting);
        }
 
        void radGridView1_CustomSorting(object sender, GridViewCustomSortingEventArgs e)
        {
            FieldInfo fieldInfo = e.GetType().GetField("rowInfo1", BindingFlags.NonPublic | BindingFlags.Instance);
            if (fieldInfo != null)
            {
                GridViewRowInfo row1 = fieldInfo.GetValue(e) as GridViewDataRowInfo;
 
                fieldInfo = e.GetType().GetField("rowInfo2", BindingFlags.NonPublic | BindingFlags.Instance);
                GridViewRowInfo row2 = fieldInfo.GetValue(e) as GridViewDataRowInfo;
 
                MyItem item1 = row1.DataBoundItem as MyItem;
                MyItem item2 = row2.DataBoundItem as MyItem;
            }
        }

Please let me know if this helped,

By the way you should avoid using e.Row1.Index or any other properties inside the GridViewCustomSortingEventArgs  e because of a bug that was set to be fixed by Q2 SP2 release and I'm not sure it got fixed yet.

Best Regards,
Emanuel Varga
0
bruno
Top achievements
Rank 1
answered on 24 Sep 2010, 09:57 AM
Hello Emanuel Varga.

Yes it will help.
Now i have stuffs more important.But later i will implement it.
Thanks.

Kind Regards,

Bruno Almeida
Tags
GridView
Asked by
bruno
Top achievements
Rank 1
Answers by
Jack
Telerik team
bruno
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or