1

나는라는 두 검도 그리드를 최적화 할 수 있습니다.KendoUI 그리드는

나는 sourcegrid에서 destinationgrid로 데이터를 전송하는 버튼이 있습니다.

코드 :

sourcegrid.select().each(function() { 
     var dataItem = sourcegrid.dataItem($(this)); 
     destinationgrid.dataSource.add(dataItem); 
     sourcegrid.removeRow($(this)); 
    }); 

임 destinationgrid 500 개 기록을 전송. 전송 프로세스가 너무 느림 입니다. 그것을 최적화하는 아이디어.

감사

당신은 편집 할 수 있습니다이 다음 http://jsfiddle.net/2qXKy/112/

+0

아마 이것은 http://codereview.stackexchange.com –

답변

1

당신을 위해 일을 속도를 내 시도 :

http://jsfiddle.net/5t5c2g1y/2/

var ds1 = new kendo.data.DataSource({ 
    data: createRandomData(500), 
    scrollable: true, 
    schema: { 
     model: { 
      id: "id", 
      fields: { 
       id: { 
        type: 'number', 
        editable: true 
       }, 
       FirstName: { 
        type: 'string', 
        editable: true 
       }, 
       LastName: { 
        type: 'string', 
        editable: true 
       } 
      } 
     } 
    } 
}); 

var ds2 = new kendo.data.DataSource({ 
    data: createRandomData(0), 
    scrollable: true, 
    schema: { 
     model: { 
      id: "id", 
      fields: { 
       id: { 
        type: 'number', 
        editable: true 
       }, 
       FirstName: { 
        type: 'string', 
        editable: true 
       }, 
       LastName: { 
        type: 'string', 
        editable: true 
       } 
      } 
     } 
    } 
}); 

var sourcegrid = $("#usersGrid").kendoGrid({ 
    dataSource: ds1, 
    editable: "popup", 
    selectable: "multiple", 
    pageable: false, 
    columns: [{ 
     field: "FirstName", 
     width: 90, 
     title: "First Name" 
    }, { 
     field: "LastName", 
     width: 90, 
     title: "Last Name" 
    }] 
}).data("kendoGrid"); 

var destinationgrid = $("#teamGrid").kendoGrid({ 
    dataSource: ds2, 
    editable: "popup", 
    selectable: "multiple", 
    pageable: false, 
    columns: [{ 
     field: "FirstName", 
     width: 90, 
     title: "First Name" 
    }, { 
     field: "LastName", 
     width: 90, 
     title: "Last Name" 
    }] 
}).data("kendoGrid"); 


$('input[type=button]').on('click',function() { 
    var removalList = []; 
    sourcegrid.select().each(function() { 

     var dataItem = sourcegrid.dataItem($(this)); 
     console.log(dataItem); 
     removalList.push(dataItem) 
     ds2.add(dataItem); 


    }); 

    for(var i = 0; i< removalList.length;i++) 
    { 
     ds1.remove(removalList[i]); 
    } 

}); 

당신이 데이터 소스와 상호 작용이 아닌 경우는 그리드 자체에서 프로세스가 훨씬 더 빨라지는 것을 볼 수 있습니다 (g 제거를 확인하라는 팝업 메시지를 제거하십시오.)

정보를 복사 할 수 있도록 콘솔 문을 추가했음을 알 수 있습니다.

다시 도움이 되길 바랍니다.

+0

에 대해 David Shorthose에게 더 적합 할 것입니다. 모든 레코드를 선택하고 destinationgrid로 전달할 때 또 다른 문제가 발생합니다. 정지/멈춘다. 얼마나 많은 초를 응답 할까? – nojla

+0

글쎄 그것은 내 머신의 속도에 달려있다. 사본을 작성하는 동안 화면/진행 막대에 메모를 추가 할 수 있습니다. 하지만 전체 사본을 만들 때 약 10-20 초가 걸렸습니다. –

+0

전체 복사본에 대해 수행 할 수있는 한 가지 방법은 선택한 행의 수가 데이터 소스의 행 수와 같은지 확인한 다음 전체 데이터 소스를 두 번째 행으로 복사하고 개별 행을 복사하는 대신 첫 번째 데이터 소스를 지우는 것입니다. –