2016-09-29 8 views
0

일부 열이있는 SmartClient ListGrid가 있습니다. ListGrid에는 편집 모드 (입력하려면 더블 클릭) 및 부울 필드가있는 일부 텍스트 필드가 있습니다.SmartClient ListGrid boolen 필드, editMode 없음 (더블 클릭)

내가해야 할 일은 부울 필드에 대해 editMode를 사용하지 않도록 설정하고 (두 번 클릭을 사용하지 않도록 설정) 일반적인 '원 클릭'을 사용하여 부울 값을 변경하는 것입니다.

다른 열은 두 번 클릭하면 작동합니다.

아이디어가 있으십니까?

내 코드 :

isc.ListGrid.create({ 
     ID: "ColumnsList", 
     saveLocally: true, 
     filterLocalData: true, 
     alternateRecordStyles: true, 
     canReorderRecords: true, 
     selectionAppearance: 'rowStyle', 
     autoFetchData: false, 
     showRollOver: true, 
     canRemoveRecords: true, 
     deferRemoval: false, 
     initWidget: function() { 
      this.Super('initWidget', arguments); 
      var me = this; 

      var fields = [ 
       {name: 'id', primaryKey: true, required: true, showIf: 'false', canEdit: false, canHide: false}, 
       { 
        name: 'name', 
        validOperators: [], 
        canEdit: true, 
        canHover: false, 
        canSort: false, 
        title: 'DB Column Name' 
       }, 
       { 
        name: 'primaryKey', 
        validOperators: [], 
        width: '12%', 
        canEdit: true, 
        canHover: true, 
        canSort: false, 
        //canToggle: true, 
        title: 'Primary Key', 
        type: 'boolean', 
        changed: function (form, item, value) { 
         // my logic to allow only one value per column is selected 
        } 
       } 
      ]; 
      me.setFields(fields); 
     } 
} 

답변

0

당신은 recordDoubleClick을 추가 할 수 있습니다, 부울 필드에 "false를 돌려"발사에서 그리드 레벨 핸들러를 방지 할 수 있습니다. 내가 질문을 이해 100 % 아니지만, 경우에 당신이 찾고있는

isc.ListGrid.create({ 
    rowDoubleClick: function (record, recordNum, fieldNum) { 
     if (this.getField(fieldNum).type != "boolean") { 
      this.Super("rowDoubleClick", arguments); 
     } 
    }, 
    fields: [ 
     { name: "isActive", type: "boolean", canEdit: false }, 
     { name: "firstName", type: "text", canEdit: true }, 
     { name: "lastName", type: "text", canEdit: true }, 
    ], 
    data: [ 
     { isActive: false, firstName: "Alex", lastName: "Smith" }, 
     { isActive: true, firstName: "Jane", lastName: "Monroe" }, 
    ] 
}); 

: 당신은 당신이 다음을 사용할 수있는 모든 부울 필드를 두 번 클릭을 해제 할 또는 경우

isc.ListGrid.create({ 
    ID: "countryList", 
    width:550, height:224, alternateRecordStyles:true, 
    // use server-side dataSource so edits are retained across page transitions 
    dataSource: countryDS, 
    // display a subset of fields from the datasource 
    fields:[ 
     {name:"countryCode", title:"Flag", width:40, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png", canEdit:false}, 
     {name:"countryName"}, 
     {name:"continent"}, 
     {name:"member_g8", recordDoubleClick:"return false"}, 
     {name:"population"}, 
     {name:"independence"} 
    ], 
    autoFetchData: true, 
    canEdit: true 
}) 
0

부울 필드 변경을 허용/금지하는 방법은 ListGridField.canToggle

입니다.