2016-10-04 2 views
0

webix 데이터 테이블을 사용하고 있습니다. 테이블에 값을 매핑하는 데 문제가 있습니다. 데이터를 볼 수 있지만 데이터가 표시되지 않습니다.webix datamapping을 사용하는 방법?

은 여기 내 매핑 내 webix 스크립트입니다 :

webix.ajax().get('urltourltourl',{ 
     // Error callback 
     error:function(text, data, XmlHttpRequest){ 
      alert("error"); 
     }, 

     //Success callback 
     success:function(text, data, XmlHttpRequest){ 
      var data = JSON.parse(text); 
      console.log(data); 
     var dtable2 = webix.ui({ 
       container:"datatable", 
       view:"datatable", 
       map:{ 
        1:data.data[0].centerNumber, 
        2:data.data[0].centerNumber 
       }, 
       columns:[ 
        { id:"1", header:"CenterNBR" , width:88}, 
        { id:"2", header:"Loan NBR", width:88}, 
        { id:"3", header:"Cust Name",  width:88}, 
        { id:"4", header:"MTD #",  width:88}, 
        { id:"5", header:"MTD $",  width:88}, 
        { id:"6", header:"MTD %",  width:88}, 
        { id:"7", header:"YTD #",  width:88}, 
        { id:"8", header:"YTD $",  width:88}, 
        { id:"9", header:"YTD %",  width:88}, 
       ], 
       autoheight:true, 
       autowidth:true, 
       data: data 
     }); 
     } 
    }); 

가 매핑 내가 데이터 JSON 개체에서 당겨있어 값이 ID를 묶어해야하지만 그렇지 않습니다. 그냥 비어 있습니다. 당신이 사용하는 "지도"를하려면

답변

1

는 속성, 당신은 영숫자 문자열

  • 변경 키 (안 숫자)에
  • 문자열로 매핑 된 값을 기록해야합니다

    map:{ 
        "a1":"#centerNumber#", 
        "a2":"#centerNumber#" 
        }, 
        columns:[ 
         { id:"a1", header:"CenterNBR" , width:88}, 
         { id:"a2", header:"Loan NBR", width:88}, 
    

http://webix.com/snippet/115c1e12

당신은 숫자 키가 필요한 경우는, scheme.init에게 대신

 scheme:{ 
     $init:function(obj){ 
      obj[1] = obj.centerNumber; 
      obj[1] = obj.centerNumber; 
     } 
     }, 

http://webix.com/snippet/2d1344bd

를 사용
관련 문제