_RowSelector.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.grid._RowSelector"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.grid._RowSelector"] = true;
  8. dojo.provide("dojox.grid._RowSelector");
  9. dojo.require("dojox.grid._View");
  10. dojo.declare('dojox.grid._RowSelector', dojox.grid._View, {
  11. // summary:
  12. // Custom grid view. If used in a grid structure, provides a small selectable region for grid rows.
  13. defaultWidth: "2em",
  14. noscroll: true,
  15. padBorderWidth: 2,
  16. buildRendering: function(){
  17. this.inherited('buildRendering', arguments);
  18. this.scrollboxNode.style.overflow = "hidden";
  19. this.headerNode.style.visibility = "hidden";
  20. },
  21. getWidth: function(){
  22. return this.viewWidth || this.defaultWidth;
  23. },
  24. buildRowContent: function(inRowIndex, inRowNode){
  25. var w = this.contentWidth || 0;
  26. inRowNode.innerHTML = '<table class="dojoxGridRowbarTable" style="width:' + w + 'px;height:1px;" border="0" cellspacing="0" cellpadding="0" role="presentation"><tr><td class="dojoxGridRowbarInner">&nbsp;</td></tr></table>';
  27. },
  28. renderHeader: function(){
  29. },
  30. updateRow: function(){
  31. },
  32. resize: function(){
  33. this.adaptHeight();
  34. },
  35. adaptWidth: function(){
  36. // Only calculate this here - rather than every call to buildRowContent
  37. if(!("contentWidth" in this) && this.contentNode){
  38. this.contentWidth = this.contentNode.offsetWidth - this.padBorderWidth;
  39. }
  40. },
  41. // styling
  42. doStyleRowNode: function(inRowIndex, inRowNode){
  43. var n = [ "dojoxGridRowbar dojoxGridNonNormalizedCell" ];
  44. if(this.grid.rows.isOver(inRowIndex)){
  45. n.push("dojoxGridRowbarOver");
  46. }
  47. if(this.grid.selection.isSelected(inRowIndex)){
  48. n.push("dojoxGridRowbarSelected");
  49. }
  50. inRowNode.className = n.join(" ");
  51. },
  52. // event handlers
  53. domouseover: function(e){
  54. this.grid.onMouseOverRow(e);
  55. },
  56. domouseout: function(e){
  57. if(!this.isIntraRowEvent(e)){
  58. this.grid.onMouseOutRow(e);
  59. }
  60. }
  61. });
  62. }