1

select2 をbackgrid.jsに統合しようとしています。Backgridjs には select2 の拡張サポートがあり、そのコードは

{
   name: "gender",
    cell: Backgrid.SelectCell.extend({
    optionValues: [["Male", "m"], ["Female", "f"]]
     }),
   label: "Gender (SelectCell)"
 }

これに基づいて、サーバーからselect2ボックスに値をロードする必要があるため、以下のようなことを試しました

var FetchSecurities = Backbone.Model.extend({
    url : Hexgen.getContextPath("/referencedata/securities")
});
var fetchSecurities = new FetchSecurities();

{
        name: "security",
        label: "Security",
        cell: Backgrid.Extension.Select2Cell.extend({

            optionValues: fetchSecurities.fetch({
                success : function() {
                    for(var objectPlace in fetchSecurities.attributes) {
                        [[fetchSecurities.attributes[objectPlace].security],[fetchSecurities.attributes[objectPlace].security]];
                    }
                }
            }),
          })
    }

しかし、私はこの例外を受け取ります.select2ボックスの値を構築するときに間違いを犯したと確信していますが、それを修正する方法がわかりません.それを成し遂げるのを手伝ってください.

Uncaught TypeError: 'optionValues' must be of type {Array.<Array>|Array.<{name: string, values: Array.<Array>}>}
4

0 に答える 0