0

select2 を使用してリモート JSON データを取得し、複数レベルで表示しようとしています。 http://ivaynberg.github.io/select2/index.html

これが私の応答です

{
  "Company": [
    {
      "name": "athenahealth Inc"
    },
    {
      "name": "Localiza Rent a Car"
    },
    {
      "name": "M and B Switchgears"
    }
  ],
  "Functional": [
    {
      "name": "arranger"
    },
    {
      "name": "ambassadors"
    }
  ],
  "Persons": [
    {
      "name": "Moustapha al"
    },
    {
      "name": "Saleh al"
    }
  ]
}

結果を複数値形式で表示したい - http://ivaynberg.github.io/select2/index.html#multi

これまでのところ、サーバー側からデータをフェッチすることはできますが、複数選択オプションを有効にする方法がわかりません。

4

1 に答える 1

1

次の形式の JSON は正常に動作します

関連する問題 - https://github.com/ivaynberg/select2/issues/58

{ "Data" : [ {
            "id" :1 ,
            "text" : "Subsection" ,
            "children" : [{
                    "id" : 2,
                    "text" : "Paru"
                      },
                      {
                    "id" : 3,
                    "text" : "Vinu"
                      }]
        },
            { "id" : 4 ,
            "text" : "Family" ,
            "children" : [{
                    "id" : 5,
                    "text" : "ChildVM"
                      },
                      {
                    "id" : 6,
                    "text" : "ChildPM"
                      }]
        }
           ]    
}    
于 2013-05-14T15:38:22.967 に答える