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); |
} |
HELP!
Thank you very much.
TOm