2014-07-23 3 views
0

...razorview 나는이 같은 일부 jQuery를 가지고

내가 ViewDescription이 비어있는 경우에 조건이 따라 표시 할
init: function() { 
     var self = this; 

     this.dataSource = new kendo.data.DataSource({ 
      transport: { 
       read: { 
        url: $.url.action(self.controller, self.action, { projectId: projectId }), 
        cache: false, 
        dataType: "json" 
       } 
      }, 
      schema: { 
       model: { 
        id: "StudyId", 
        fields: { 
         Name: { type: "string" }, 
         ViewName: { type: "string" }, 
         Description: { type: "string" }, 
         ViewDescription: { type: "string" }, 
         UpdateDate: { type: "date" }, 
         StudyId: { type: "number" }, 
         NextMilestoneName: { type: "string" }, 
         NextMilestoneDate: { type: "date" }, 
         StudyStatus: { type: "string"} 
        } 
       } 
      }, 
      sort: { field: "UpdateDate", dir: "desc" }, 
      sortable: { mode: "single", allowUnsort: false }, 
      pageSize: 4 
     }); 

...

@if (!String.IsNullOrEmpty(????)) 
{ 
    <span><strong>@Resources.Resources.Description1 </strong>#:ViewDescription#</span> 
    <br> 
} 

내가 할 수있는 ' 그것을 알아낼! 내가 ViewDescription에 액세스하려면 ?????를 넣어야합니까?

답변

0

게시 한 내용을 기반으로, 검도 컨트롤에서 "Read()"를 호출 할 때까지 페이지가로드 될 때까지 존재하지 않는 정보를 기반으로 면도기보기를 활용하려는 것 같습니다. 면도기보기는 자바 스크립트가 실행되기 전에 작성됩니다. 그러나 코드가 실행 된 후 JS에서 이와 같은 작업을 수행 할 수 있습니다. (여기에서 확인하십시오 : http://docs.telerik.com/kendo-ui/api/framework/datasource#events-change)

init : function() { var self = this; 당신이

을 출발하여 원하는 목적지까지가는
this.dataSource = new kendo.data.DataSource({ 
     transport: { 
      read: { 
       url: $.url.action(self.controller, self.action, { projectId: projectId }), 
       cache: false, 
       dataType: "json" 
      } 
     }, 
     change: function(e) { 
     if(e.items["ViewDescription"]!=null){ 
      $("#IDofDivHere").append("<span><strong>@Resources.Resources.Description1</strong>"+e.items["ViewDescription"]+"</span><br>"); 
     } 
     }, 
     schema: { 
      model: { 
       id: "StudyId", 
       fields: { 
        Name: { type: "string" }, 
        ViewName: { type: "string" }, 
        Description: { type: "string" }, 
        ViewDescription: { type: "string" }, 
        UpdateDate: { type: "date" }, 
        StudyId: { type: "number" }, 
        NextMilestoneName: { type: "string" }, 
        NextMilestoneDate: { type: "date" }, 
        StudyStatus: { type: "string"} 
       } 
      } 
     }, 
     sort: { field: "UpdateDate", dir: "desc" }, 
     sortable: { mode: "single", allowUnsort: false }, 
     pageSize: 4 
    }); 

그래서 우리는 당신이 원하는 데이터를 추가 한 후 데이터를 검색 할 때 (아약스에서 성공 콜백 등) 해고해야 검도 이벤트 변화를 배선하고있다
관련 문제