CheckboxSelectionModel

15838 단어

1. CheckboxSelectionModel 약자sm2.sm에서 백엔드로 전송된 json 대상이 selected 속성을 포함하는지 여부를 표시합니다
  1. { root:[
  2. { id: '1', code: '1001', name: ' ', sex: '1', age: '23', selected: false},
  3. { id: '2', code: '1002', name: ' ', sex: '1', age: '25', selected: true}
  4. ]}


  1. var sm = new Ext.grid.CheckboxSelectionModel({
  2. checkOnly: true,
  3. /*
  4. sm sm
  5. */
  6. selectAll : function(){
  7. sm.clearSelections(); //
  8. var storeLength = sm.grid.store.getCount();
  9. for( var i = 0; i < storeLength; i++){
  10. var record = sm.grid.store.getAt(i);
  11. // record selected
  12. var selected = record.data[ 'selected'];
  13. if(!selected){
  14. var id = record.get( 'id');
  15. // id, id Record,
  16. var si = store.indexOfId(id);
  17. sm.selectRow(i, true);
  18. }
  19. }
  20. },
  21. /*
  22. sm
  23. */
  24. renderer: function(v, p, record){
  25. // record selected
  26. var selected = record.data[ 'selected'];
  27. if(!selected){
  28. //selected false
  29. return '
     
    '
    ;
  30. } else{
  31. //selected true
  32. return '';
  33. }
  34. }
  35. });

3.sm

  1. var sm = new Ext.grid.CheckboxSelectionModel({
  2. //
  3. handleMouseDown : Ext.emptyFn,
  4. //true
  5. singleSelect : true
  6. });

좋은 웹페이지 즐겨찾기