[개발] 프로그램 지식

[kendo ui] 그리드 안에서 일련번호, 행번호 부여하는 방법 ( 페이징 없는 경우 && 페이징 있는 경우 )

  • -
반응형

페이징 없는 경우

  columns: [
            {  title: "No", width: "50px", attributes : { style : "text-align : center; " }, template: "<span class='row-number'></span>" },




dataBound : function() {
        	var rows = this.items();
            $(rows).each(function () {
                var index = $("#grid2").data("kendoGrid").dataSource.total() - $(this).index();
                var rowLabel = $(this).find(".row-number");
                $(rowLabel).html(index);
            });
        }

 

 

 

 

 

 

 

 

 

 

페이지 있는 경우

 columns: [
            {  title: "No", width: "50px", attributes : { style : "text-align : center; " }, template: "<span class='row-number'></span>" },




dataBound : function() {
			var rows = this.items();
			$(rows).each(function () {
				var index = ($("#gridDetail").data("kendoGrid").dataSource.total() -  $(this).index()) - ($("#gridDetail").data("kendoGrid").dataSource.pageSize() * ($("#gridDetail").data("kendoGrid").dataSource.page() - 1));
				var rowLabel = $(this).find(".row-number");
				$(rowLabel).html(index);
			});
		}

 

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.