2011-02-03 3 views
0

바운드 행의 존재 여부를 판별하는 가장 좋은 방법은 무엇입니까? 더 나은 방법이있을 가지고Telerik ASP.NET MVC Grid에서 0 행 감지

gridDataBound: function (event) 
{ 
    var rows = $('tbody tr:has(td)', this); 
    if (rows.length == 0 || (rows.length == 1 && rows[0].innerText == "No records to display')) 
     $('#GridSection').hide("slow"); 
} 

:

현재, 나는 다음과 같은 클라이언트 측 OnDataBound 이벤트 및 코드를 사용하고 있습니다!

if ($(this).find(".t-no-data").length) { 
    $("#GridSection").hide("slow"); 
} 

답변

1

better- 정말 느낌이 솔루션을 생각 기록의.

그래서, 당신은 사용 레코드 수를 얻을 수 있습니다 :

$('#grid-name').data('tGrid').data.length; 
0

아, 주위를 파고 몇 분 나는 내가 짧은 버전을 제안 할 수

if ($("tbody tr:has(td).t-no-data", this).length != 0) { 
    $("#GridSection").hide("slow"); 
} 
0

$('#grid-name').data('tGrid').data 모두의 배열입니다 :

+0

를 더 레코드가없는 경우를 제외하고. 이 경우'data'는 정의되지 않았습니다. – kdawg

관련 문제