2013-10-31 103 views
1

我有一個帶彈出可編輯屬性的Kendo UI網格。我想在添加/編輯模式下使我的下拉列更寬,但我似乎無法改變寬度。我確實可以改變網格本身的寬度,但不能在編輯模式下。Kendo UI網格編輯模式列樣式

這是否與某種編輯模板有關?我無法找到它的文檔。

謝謝。 鮑勃

這裏是我的樣品格:

 positGrid = $("#positGrid").kendoGrid({ 
     dataSource: datasource, 
     toolbar: [ 
      { name: "create", text: "Add Position" } 
     ], 
     columns: [{ 
      field: "PositionId", 
     }, 
     { 
      field: "Portfolio", 
      editor: portfolioDropDownEditor, template: "#=Portfolio#" 
     }, 
     { 
      field: "Instrument", 
      width: "220px", 
      editor: instrumentsDropDownEditor, template: "#=Instrument#", 
     }, 
     { 
      field: "NumOfContracts", 
     }, 
     { 
      field: "BuySell", 
      editor: buySellDropDownEditor, template: "#=BuySell#" 
     }, 
     { 
      command: [ 
       { 
        name: "edit", 
        click: function (e) {   
        } 
       }, 
       "destroy" 
      ] 
     }, 
     ], 
     sortable: true, 
     editable: "popup", 
    }); 

回答

1

您可以連接多達edit事件來設置下拉選項:

name: "edit", 
    click: function (e) { 
     if (!e.model.isNew()) {   
      var dropdown = e.container.find("input[name=Portfolio]").data("kendoDropDownList"); 
      dropdown.list.width(500); 
     } 
     } 
+0

剛一所說明,請。當我點擊我的「添加」時,屬性e.model.isNew()被評估爲TRUE,然後當我點擊內聯的「編輯」按鈕時再次爲TRUE。那是因爲它還沒有被保存,所以網格仍然認爲它是新的? –

+0

你說得對,[api](http://docs.kendoui.c​​om/api/framework/model#methods-isNew)說的是:「如果指定的字段的值等於默認值(通過字段配置)模型被認爲是新的。「 –

相關問題