2016-12-09 3 views
0

私は剣道の角度チャートと複数選択を使用しています。今、私は両方のデータを読み込むために同じAPIを2度呼びます。同じAPI呼び出しで複数のスキーマを定義する方法はありますか?私のデータは、私は1回のAPI呼び出しで複数選択で追加されるグリッドと「NameListで」の「リスト」を追加したい剣道図や剣道マルチ選択に同じデータソースを使用するにはどうしたらいいですか?

{ 
    "List": [ 
    { 
     "Name": "xyz", 
     "Activation": "2016-12-08",  
     "End": "2016-12-09", 
     "Run": "45", 
     "Status": "FAILURE", 
     "color": "red" 
    }, 
    { 
     "Name": "wqe", 
     "Activation": "2016-12-07",   
     "End": "2016-12-08", 
     "Run": "46", 
     "Status": "FAILURE", 
     "color": "red" 
    } 
    ], 
    "NameList": [ 
    { 
     "Name": "joo" 
    }, 
    { 
     "Name": "foo" 
    }, 
    { 
     "Name": "too" 
    } 
    ] 
} 

を、以下のようなものです。

現在、私は手動で自分でリクエストを作り、local (custom) transportまたは静的を使用する場合、あなたのシナリオ内の1つのリクエストで両方のウィジェットのデータバインディングを達成することが可能であるAPI

function getDataSource(requestUrl) { 

    var dataSource = { 
     transport: { 
      read: requestUrl, 
      dataType: "json" 
     }, 
     schema: { 
      data: "List", 
      total: function (response) { 
       return response.StatisticList.length; 
      }, 
      model: { 
       fields: { 
        Name: { type: "string" }, 
        Activation: { type: "date" }, 
        End: { type: "date" }, 
        Run: { type: "number" }, 
        Status: { type: "string" },       
        color: { type: "string" } 
       } 
      } 
     }, 
     sort: { field: "ActivationTime", dir: "desc" }, 
     pageSize: common.Grid.pageSize 
    }; 
    return dataSource; 
} 

function getMultiSelectDataSource(requestUrl) { 

    var dataSource = { 
     transport: { 
      read: requestUrl, 
      dataType: "json" 
     }, 
     schema: { 
      data: "NameList", 
      model: { 
       fields: { 
        Name1: { type: "string" } 
       } 

      } 
     } 
    }; 
    return dataSource; 
} 

答えて

1

を呼び出すために、次のコードを使用していますdataSource.dataチャートとマルチセレクションのデータソースでの割り当て。

関連する問題