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

BUG Grid sorting and filtering calendar bug

3 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 22 Dec 2008, 08:23 PM

I think this behavior is a bug. Try to do the same to replicate it. 

<telerik:RadGrid ID="RadGrid1" runat="server" 
            onneeddatasource="RadGrid1_NeedDataSource"   
        Skin="Office2007" AllowFilteringByColumn="True" AllowPaging="True"   
        AllowCustomPaging="True" VirtualItemCount="10000" 
        AllowSorting="True" GridLines="None" oncolumncreated="RadGrid1_ColumnCreated"   
        ShowFooter="True" onsortcommand="RadGrid1_SortCommand"   
        onitemdatabound="RadGrid1_ItemDataBound"   
        onitemcommand="RadGrid1_ItemCommand"  EnableLinqExpressions="false">  
          
<HeaderContextMenu Skin="Office2007" EnableTheming="True">  
<ExpandAnimation Type="None" Duration="0" /> 
<CollapseAnimation Type="None" Duration="0" /> 
</HeaderContextMenu> 
 
        <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
 
<MasterTableView EnableHeaderContextMenu="true" AllowMultiColumnSorting="True" AllowCustomSorting="true" ClientDataKeyNames="n_id,n_code_name,n_nug_typ_id" > 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
</MasterTableView> 
 
        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowRowsDragDrop="true" EnableRowHoverStyle="true" > 
            <Selecting AllowRowSelect="True" /><ClientEvents OnRowDblClick="RowDblClick" /> 
            <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
            <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"></Resizing> 
        </ClientSettings> 
 
<FilterMenu Skin="Office2007" EnableTheming="True">  
<ExpandAnimation Type="None" Duration="0" /> 
<CollapseAnimation Type="None" Duration="0" /> 
</FilterMenu> 
    </telerik:RadGrid> 
      
 

My dataset has 15 columns. Only the first 4 columns are displayed. The rest are available through client side header menu. (New feature of you 3q 2008 grid). The fourth column (last visible) has a name n_date_created. When I click the img of calendar (filter row), nothing happens. But this happens only when my datasource is implicitly sorted by this column! When this column is not participate in multicolumn sorting, calendar popups.

My code (only interesting parts) :

During NeedDataSource this code does nothing interesting from your point of view:
        protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
        {  
            int dbAttributesCount, i, j;  
            DataTable dtMetadata;  
 
            // získání dat  
            this.ReadQueryAndRun();  
 
            dbAttributesCount = this.dsTranslatedAttributes.Tables[0].Rows.Count;  
            dtMetadata = this.dsTranslatedAttributes.Tables[0];  
            DataColumn dataColumn;  
 
            i = 0;  
            while (i < this.dsData.Tables[0].Columns.Count)  
            {  
                dataColumn = this.dsData.Tables[0].Columns[i];  
 
                for (j = 0; j < dbAttributesCount; j++)  
                {  
                    if (dataColumn.ColumnName == (string)dtMetadata.Rows[j]["code_name"])  
                        break;  
                }  
 
                if ((j == dbAttributesCount) && (this.dsData.Tables[0].Columns[i].ColumnName != "renderStatus"))  
                    this.dsData.Tables[0].Columns.Remove(dataColumn);  
                else  
                    i++;  
            }  
 
            thisthis.RadGrid1.DataSource = this.dsData.Tables[0];  
        } 

I am hiding some columns and not displaying another columns according to the definition from elsewhere during columCreated event:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
        {  
            // zkusí se dohledat překládaná popiska sloupce  
              
            DataRow[] foundRows;  
            XmlNode xnColumn;  
 
            string columnUniqueName;  
 
            columnUniqueName = e.Column.UniqueName;  
 
            if (columnUniqueName != "ExpandColumn")  
            {  
                // nastavení překládaného záhlaví sloupce  
                if (this.dsTranslatedAttributes != null)  
                {  
                    foundRows = this.dsTranslatedAttributes.Tables[0].Select("code_name = '" + columnUniqueName + "'");  
                    if (foundRows.Length > 0)  
                    {  
                        e.Column.HeaderText = (string)foundRows[0]["name"];  
                    }  
 
                    // skrytí sloupce, který není třeba ukazovat  
                    if (columnUniqueName == "renderStatus")  
                        e.Column.Visible = false;  
 
                    // nastavení viditelnosti jednotlivých sloupců dle definice v dotazu  
                    e.Column.Display = false;  
 
                    if (columnUniqueName != null && columnUniqueName != "")  
                    {  
                        xnColumn = this.xdQuery.SelectSingleNode("//list/grid[@type='nuggets']/columns/col[@name='" + columnUniqueName + "']");  
                        if (xnColumn != null)  
                        {  
                            // nastavení viditelnosti jednotlivých sloupců dle definice v dotazu  
                            if (xnColumn.Attributes["state"] != null && xnColumn.Attributes["state"].Value == "1")  
                                e.Column.Display = true;  
                            else  
                                e.Column.Display = false;  
                        }  
                    }  
                }  
            }  
        } 

I am replacing some columns of some rows when the user has not enough rights during ItemDataBound event:

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            GridDataItem dataItem;  
            long nuggetId;  
            string attCodeName;  
              
            if (this.gnl.containsNuggetsWithAPActivated)  
            {  
                if (e.Item is GridDataItem)  
                {  
                    dataItem = (GridDataItem)e.Item;  
                    nuggetId = long.Parse(dataItem["n_id"].Text);  
 
                      
 
                    this.gnl.alNuggetsWithAPActivated.Contains(nuggetId.ToString());  
                    {  
                        // všechna metadata musí být dohledána v dsCheckedAttributes, jinak je nutné je vyeliminovat  
 
                        int attributeCount = this.dsTranslatedAttributes.Tables[0].Rows.Count;  
                        for (int i = 0; i < attributeCount; i++)  
                        {  
 
                            // některé atributy jsou viditelné vždy  
                            attCodeName = (string)this.dsTranslatedAttributes.Tables[0].Rows[i]["code_name"];  
                            if (attCodeName != "n_id" && attCodeName != "n_nug_typ_id" && attCodeName != "renderStatus")   
                            {  
                                if (!(this.dsCheckedAttributes.Tables[0].Select("id = " + nuggetId.ToString() + " and code_name='" + attCodeName + "'").Length > 0))  
                                {  
                                    if (dataItem[attCodeName] != null)  
                                        dataItem[attCodeName].Text = "~RR~";  
                                }  
                            }  
 
                        }  
                    }  
                }  
            }  
        } 

When the grid is loaded for the first time, I do this (In my case, I am sorting by the n_date_created column): Little triangle appears in the right column of the grid (calendar column):
if (gnp.sortedColumn != null)  
                    {  
                        se = new GridSortExpression();  
                        se.FieldName = gnp.sortedColumn;  
                        if (gnp.sortedOrder == "asc")  
                            se.SortOrder = GridSortOrder.Ascending;  
                        else  
                            se.SortOrder = GridSortOrder.Descending;  
                        this.RadGrid1.MasterTableView.SortExpressions.Add(se);  
                    } 
Calendar filter column will NOT popup!!!!!!!!!!!!!!!!!!!!!!!!!!!!

HELP!

Thank you very much.

TOm

3 Answers, 1 is accepted

Sort by
0
tomas
Top achievements
Rank 1
answered on 23 Dec 2008, 03:28 PM
I have found also this:

Now I do nothing during ColumnCreated event

This is the current behavior of calendar image in filter row.

Image clicked, calendar popups.
I am clicking somewhere outside the grid. Calendar hides. I am clicking on image, calendar popups. I am clicking on a grid row with data. Calendar hides. I am clicking on the calendar icon, nothing happens.

This happens for two calendar columns in my filter row (3 calendars currently).

All calendar textboxes are small and does not occupy all available place.

I need HELP!!!

Thank you Tom
0
tomas
Top achievements
Rank 1
answered on 23 Dec 2008, 04:04 PM
Hello Telerik.

I think, you should give me huge amount of your Telerik points, because I have already explored where the bug is and it takes me many hours.

:-)

When you specify AllowRowResize="True" the filter calendar will not popup after row clicking.

Please, give me a hint, how to solve this.

Thank you very much.

Tom
0
Rosen
Telerik team
answered on 29 Dec 2008, 01:10 PM
Hello tomas,

Indeed such behavior can be observed with current (Q3 2008) release of RadControls for ASP.NET AJAX suite. However our developers has already been addressed it thus I'm attaching a trial version of the latest internal build (please submit a formal support ticket for a dev version). Please give it a spin and let us know if this helps. Your telerik points has been updated too.

Please excuse us for the inconvenience.

Greetings,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
tomas
Top achievements
Rank 1
Answers by
tomas
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or