ExtJs CheckboxSelectionModel 전체 선택 작업 후 테이블 헤더의 checkBox 비우기

1627 단어 functionExtJs
Ext.override(Ext.grid.GridView,{
	
    onRowSelect : function(row){
        this.addRowClass(row, "x-grid3-row-selected");
    	var selected = 0;
    	var len = this.grid.store.getCount();
        for(var i = 0; i < len; i++){
            var r = this.getRow(i);
            if(r){
               if( this.fly(r).hasClass('x-grid3-row-selected'))selected = selected + 1;
            }
        }
    	
        var hd = this.grid.getEl().select('div.x-grid3-hd-checker').first();   
        
        if (selected == len && !hd.hasClass('x-grid3-hd-checker-on')) {
        	 hd.addClass('x-grid3-hd-checker-on'); 
        }
    },

    onRowDeselect : function(row){
        this.removeRowClass(row, "x-grid3-row-selected");
        	var selected = 0;
        	var len = this.grid.store.getCount();
            for(var i = 0; i < len; i++){
                var r = this.getRow(i);
                if(r){
                   if( this.fly(r).hasClass('x-grid3-row-selected'))selected = selected + 1;
                }
            }
            var hd = this.grid.getEl().select('div.x-grid3-hd-checker').first();   
            
            if (selected != len && hd.hasClass('x-grid3-hd-checker-on')) {
            	 hd.removeClass('x-grid3-hd-checker-on'); 
            }
    }
});

원본 코드를 다시 쓰면 기능을 실현할 수 있다

좋은 웹페이지 즐겨찾기