2014-10-19 5 views
0

json 데이터가있는 URL에서 검도 표를 만들었습니다. 여기에 코드이며 (메신저 YII 프레임 워크 작업) ajax 호출 후 검도 그리드 다시로드

$('#grid').kendoGrid({ 
    dataSource: { 
     transport: { 
     read: { 
     url: "http://localhost/CoreProcess/proceso/getusers", 
     dataType: "json", 
     }, 
     update: { 
     url: "http://localhost/CoreProcess/usuario/uptdate", 
     dataType: "json" 
     }, 
     destroy: { 
     url: "http://localhost/CoreProcess/usuario/delete", 
     dataType: "json" 
     } 
    }, 
    pageSize: 10 
    }, 
    pageable: { 
     refresh: true, 
     pageSizes: true, 
     buttonCount: 5 
    }, 
    editable: "inline", 
    columns: [{ title: "Nombre", field: "NOMBRE" }, 
       { title: "Apellidos", field: "APELLIDOS"}, 
       { title: "Email", field: "EMAIL"}, 
       { command: ["edit", "destroy"], title: "Acciones"}],   
}); 

지금 같은 페이지에 내가 PHP를 방법에 아약스 호출을 통해 데이터베이스에 새로운 데이터를 삽입하는 작은 형태를 가지고 작품을 좋아

$.ajax({ 
    type: "POST", 
    url: "http://localhost/CoreProcess/proceso/agregarparticipantes/uuid/" + uuid, 
    data: 
    { 
    post_participante: participante, 
    post_apellidos: apellidos, 
    post_email: email, 
    }, 
    success: function(result) 
    { 
    alert(result); 
    var dSource = $('#grid').data('kendoGrid').dataSource; 
    dSource.transport.options.read.url = "http://localhost/CoreProcess/proceso/getusers"; 
    dSource.read(); 
    } 
}); 

데이터베이스에 새 레코드를 만드는 작업은 정상적으로 작동하지만 문제는 그 후에 새로운 정보가있는 표를 다시로드하려는 것입니다. 변경된 json URL을 다시 읽는 것입니다. 내가

$('#grid').data('kendoGrid').dataSource.read(); 
$('#grid').data('kendoGrid').dataSource.refresh(); 

그러나 아무것도 같은 많은 것들을 시도, 내가 검도와 멍청한 놈입니다 ... 사람이 나를 도울 수 있을까? 모두 고마워요

+1

다시 URL을 설정할 필요가 없습니다. $ ('# grid'). 데이터 ('kendoGrid'). dataSource.read(); 작동해야합니다. 새 행이 데이터베이스에 삽입 되었습니까? –

+0

예. 사이트를 다시로드하면 새 행이 눈금에 나타납니다. 도움을 주셔서 감사합니다 – sklapez

답변

1

dataSource 읽기 설정에 기본 HTTP 메소드 'GET'이 있으며 쿼리 데이터를 캐싱하고 있습니다. 해결 방법 1 :

read: { 
    url: "http://localhost/CoreProcess/proceso/getusers", 
    dataType: "json", 
    type: "POST", 
}, 

해결 방법 2 :

read: { 
    url: "http://localhost/CoreProcess/proceso/getusers", 
    dataType: "json", 
    cache: false, 
}, 

하고 그냥 dataSource.read()를 사용하는 방법.

+0

도움을 주셔서 감사합니다, 나는 아무것도하지만, 여전히 같은 시도 ... – sklapez

+1

그것은 정말 위드 :(당신은 이것을 시도 할 수 :'var dSource = $ ('# grid'). data ('kendoGrid') dataSource; ' 'dSource.transport.options.read.url = "http : // localhost/CoreProcess/proceso/getusers?"(새 날짜(). getTime()); ' 'dSource .read();' –

2

마침내 나는 그것을 고치고 Kendo와는 아무 것도 보지 못했습니다. 메신저 Yii 프레임 워크를 사용하고 데이터베이스에 레코드를 저장 한 후에는 새 정보를로드 할 수 있도록 간단한 정보를 새로 고쳐야 만합니다. 그러나 Kendo의 새로운 점은 그것이 잘못되었거나 옳은지 알 수 없었습니다.

간단한 명령은

$('#grid').data('kendoGrid').dataSource.read(); 

나는이 환상적인 도구를 사용하여 계속 지원을 위해

감사합니다 모두 나에게 충분했다. 다음 문제에서보기 xD

+0

이것은 내가 원하는 것입니다. 공유해 주셔서 감사합니다 ... –