このIgnite UIチュートリアルに基づいて、ドラッグ アンド ドロップ ツリー リストを作成しました。ツリー リストはうまく機能していますが、問題は子にあります。画像に示すように、子で未定義になっています
ここに私のtsコードがあります:
this.options = {
checkboxMode: 'triState',
singleBranchExpand: true,
dataSource: jQuery.extend(true, [], this.ServiceCounterPointRelations),
dataSourceType: 'json',
initialExpandDepth: 2,
pathSeparator: '.',
bindings: {
textKey: 'ServiceCounter',
valueKey: 'ServiceCounterId',
childDataProperty: 'ServicePoints'
},
dragAndDrop: true,
dragAndDropSettings: {
allowDrop: true,
customDropValidation: function (element) {
var valid = true,
droppableNode = jQuery(this);
if (droppableNode.is('a') && droppableNode.closest('li[data-role=node]').attr('data-value') === 'File') {
valid = false;
}
return valid;
}
}
};
this.ServiceCounterPointRelationsには、次の json が含まれています
"ServiceCounterPointRelations": [
{
"ServiceCounterId": 2,
"ServiceCounter": "Main Counter",
"ServicePoints": [
{
"ServicePointId": 2,
"ServicePoint": "Service Point 1"
}
]
},
{
"ServiceCounterId": 3,
"ServiceCounter": "Counter 1",
"ServicePoints": []
},
{
"ServiceCounterId": 4,
"ServiceCounter": "Test for 2",
"ServicePoints": []
},
{
"ServiceCounterId": 5,
"ServiceCounter": "ASD",
"ServicePoints": [
{
"ServicePointId": 1,
"ServicePoint": "DER"
},
{
"ServicePointId": 3,
"ServicePoint": "ER"
}
]
},
{
"ServiceCounterId": 6,
"ServiceCounter": "ASD",
"ServicePoints": []
},
{
"ServiceCounterId": 7,
"ServiceCounter": "EEE",
"ServicePoints": []
},
{
"ServiceCounterId": 8,
"ServiceCounter": "With New Tog",
"ServicePoints": []
}
]
問題を見つけましたが、まだ修正を探しています。問題は、親のtextKey のみを 'ServiceCounter' としてバインドし、valueKey を 'ServiceCounterId' としてバインドしていることです。しかし、子の textKey と valueKey は異なります。これを行う方法がわかりません。どんなアドバイスも役に立ちます。ありがとう。