Rad Telerik GridGroupByExpression은 그리드 정렬 버튼을 클릭할 때까지 그룹화되지 않습니다.
문제
소스로 데이터 테이블이 있는 RadGrid가 있습니다.AllowCustomPaging을 true로 설정했습니다.
<telerik:RadGrid runat="server" ID="RadGridSearchResults"
PageSize="50" AllowPaging="true" AllowCustomPaging="true"
OnNeedDataSource="RadGridSearchResults_NeedDataSource" Skin="Default">
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
</telerik:RadGrid>
RadGridSearchResults_NeedDataSource 메서드 뒤에 있는 내 코드의 코드는 다음 열로 데이터 테이블을 채우고 반환합니다.
dataTableSearchResults.Columns.Add("recipeId", typeof(string));
dataTableSearchResults.Columns.Add("ingredientsIds", typeof(string));
dataTableSearchResults.Columns.Add("country", typeof(string));
dataTableSearchResults.Columns.Add("author", typeof(string));
dataTableSearchResults.Columns.Add("style", typeof(string));
dataTableSearchResults.Columns.Add("friendly", typeof(string));
dataTableSearchResults.Columns.Add("name", typeof(string));
RadGrid가 데이터바인딩되면 다음을 실행합니다.
var expression = GridGroupByExpression.Parse(
"recipeId [Recipe], count(recipeId) ingredientsIds [Ingredients]
Group By recipeId");
this.RadGridSearchResults.MasterTableView.GroupByExpressions.Add(expression);
this.RadGridSearchResults.GroupingEnabled = true;
그러면 내 래드그리드가 그들이 만든 것과 비슷하게 보일 것이라고 기대합니다. 여기에 있어요 '표현식별 그룹화' 버튼을 클릭하면:
대신 다음과 같습니다.
'정렬' 버튼을 클릭한 직후에만 살펴봅니다.
어떤 단서가 있나요?수동으로 정렬을 호출해 보았지만 성공하지 못했습니다.
해결책
그룹 표현식을 추가할 때 그리드의 Rebind() 메서드를 호출하여 상태를 새로 고치나요?이는 컨트롤을 암시적으로 다시 바인딩하지 않는 포스트백 이벤트 처리기에서 그룹화를 적용하는 경우에 필요합니다.
형사
제휴하지 않습니다 StackOverflow