2013-06-27 40 views
0

我想用backgrid.js使用畫筆下拉列表?

我創建下面列創建表格單元格的下拉列表:

{ name: "priority", 
    label: "Priority", 
    cell: Backgrid.SelectCell.extend({ 
     // It's possible to render an option group or use a 
     // function to provide option values too. 
     optionValues: [["one", "a"], ["Two", "b"], ["Three", "c"], ["Four","d"], ["Five", "e"]] 
    }) 
    } 

但這並未使Priority列。它也不顯示下拉列表。

幫幫我,我犯了什麼錯誤?

回答

0

試試這個

var PriorityComboCell = Backgrid.Cell.extend({ 


template: _.template(

       '<select name="#" id="priority_select"> ' + 
       '<option selected="selected"></option>' + 
       '<option id="a">One</option>' + 
       '<option id="b">Two</option> ' + 
       '<option id="c">Three</option>' + 
       '</select>' 
      ), 
      events: { 

      }, 

      render: function() { 

       this.$el.html(this.template({})); 
       return this; 
      } 
    });