2016-01-14 180 views
0

我想使用使用彈出式菜單進行註冊,我必須在某處使用單選按鈕。它應該有多種選擇,只有一種可以選擇。如何添加單選按鈕有多種選擇

這裏是我的代碼:

這裏是我的PersonModel.js

define([ 
'kendo/kendo.data.min', 'robe/Validations'], function() { 

var PersonModel = kendo.data.Model.define({ 
    id: "oid", 
    fields: { 
     oid: { 
      editable: false, 
      nullable: true, 
      type: "string" 
     }, 
     lastUpdated: { 
      editable: true, 
      nullable: true, 
      type: "string" 
     }, 
     tckNo:{ 
      editable:true, 
      nullable:false, 
      type:"string", 
      validation :getValidations("tckNo","T.C. Kimlik Numarası",true,false,11,11,"[0-9]") 
     }, 
     name: { 
      editable: true, 
      nullable: false, 
      type: "string" 
     }, 
     surname: { 
      editable: true, 
      nullable: false, 
      type: "string" 
     }, 
     birthday: { 
      editable: true, 
      nullable: false, 
      type: "date" 
     }, 
     isSingle:{ 
      editable:true, 
      nullable:false, 
      type:"boolean" 
     } 
    } 
}); 
return PersonModel;}); 

這裏是PersonDataSource.js

define(['common/SingletonDataSource', './PersonModel'], function (SingletonDataSource, personModel) { 

var personDataSource = SingletonDataSource.define({ 
    name: "personDataSource", 
    parameters: { 
     transport: { 
      read: { 
       type: "GET", 
       url: AdminApp.getBackendURL() + "person/all", 
       dataType: "json", 
       contentType: "application/json" 
      }, 
      update: { 
       type: "POST", 
       url: AdminApp.getBackendURL() + "person", 
       dataType: "json", 
       contentType: "application/json" 
      }, 
      destroy: { 
       type: "DELETE", 
       url: AdminApp.getBackendURL() + "person", 
       dataType: "json", 
       contentType: "application/json" 
      }, 
      create: { 
       type: "PUT", 
       url: AdminApp.getBackendURL() + "person", 
       dataType: "json", 
       contentType: "application/json" 
      }, 
      parameterMap: function (options, operation) { 
       if (operation !== "read") { 
        return kendo.stringify(options); 
       } 
      } 
     }, 
     batch: false, 
     pageSize: 25, 
     schema: { 
      model: personModel 
     } 
    } 
}); 

return personDataSource;}); 

這裏是PersonManagement.js:

define([ 
    'text!./PersonManagement.html', 
    './PersonDataSource', 
    'kendo/kendo.grid.min', 
    'robe/view/RobeView'], 
function(view,PersonDataSource){ 
    var PersonManagementView = require('robe/view/RobeView').define({ 
     name:"PersonManagementView", 
     html:view, 
     containerId:"container", 
     initialize:function(){ 
      var grid = $("#personGrid").kendoGrid({ 
       dataSource: PersonDataSource.get(), 
       sortable: true, 
       autoBind: false, 
       pageable: { 
        refresh: true 
       }, 
       toolbar: [ 
        { 
         name: "create", 
         text: "Yeni Kişi" 
        } 
       ], 
       columns: [ 
        { 
         field:"tckNo", 
         title:"TC Kimlik Numarası", 
         format:"{0:n0}" 
        }, 
        { 
         field: "name", 
         title: "Ad" 

        }, 
        { 
         field: "surname", 
         title: "Soyad" 
        }, 
        { 
         field: "birthday", 
         title: "Doğum Günü" 
        }, 
        { 
         command: [ 
          { 
           name: "edit", 
           text: { 
            edit: "", 
            update: "Tamam", 
            cancel: "İptal" 
           }, 
           className: "grid-command-iconfix" 
          }, 
          { 
           name: "destroy", 
           text: "", 
           className: "grid-command-iconfix" 
          } 
         ], 
         title: " ", 
         width: "120px" 
        } 
       ], 
       editable: { 
        mode: "popup", 
        window: { 
         title: "Kayıt".i18n() 
        }, 
        confirmation: "Silmek istediğinizden emin misiniz?".i18n(), 
        confirmDelete: "Yes" 
       } 
      }); 
     } 
    }); 
    return PersonManagementView; 
} 

);

你能幫助我嗎?

+0

這不是一個真正的答案,它與UX有關,但傳統上我認爲複選框會用於多選。通常我希望只允許選擇單選按鈕列表的選項。 也許你可以切換到複選框列表? –

回答

0

你也有使用複選框。 單選按鈕不允許多選。

+0

我不想多選我想從多個選項(選項)中選擇一個。 – luffy

+0

你不能。單選按鈕有一個選擇。對於多種選擇,您需要複選框。檢查是否至少有一個使用jQuery進行檢查。一個月前有同樣的問題。 – osanger

+0

我想我無法實現解釋。我不想多選。我的意思是用戶可以從多個選項中選擇一個。我知道單選按鈕是如何工作的。你現在明白朋友嗎?感謝您的興趣。 – luffy