Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

  1. /*
  2. * Ext JS Library 2.2
  3. * Copyright(c) 2006-2008, Ext JS, LLC.
  4. * licensing@extjs.com
  5. *
  6. * http://extjs.com/license
  7. */
  8. Ext.grid.CheckColumn = function(config){
  9. Ext.apply(this, config);
  10. if(!this.id){
  11. this.id = Ext.id();
  12. }
  13. this.renderer = this.renderer.createDelegate(this);
  14. };
  15. Ext.grid.CheckColumn.prototype ={
  16. init : function(grid){
  17. this.grid = grid;
  18. this.grid.on('render', function(){
  19. var view = this.grid.getView();
  20. view.mainBody.on('mousedown', this.onMouseDown, this);
  21. }, this);
  22. },
  23. onMouseDown : function(e, t){
  24. if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
  25. e.stopEvent();
  26. var index = this.grid.getView().findRowIndex(t);
  27. var record = this.grid.store.getAt(index);
  28. record.set(this.dataIndex, !record.data[this.dataIndex]);
  29. }
  30. },
  31. renderer : function(v, p, record){
  32. p.css += ' x-grid3-check-col-td';
  33. return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'">&#160;</div>';
  34. }
  35. };