_RowSelector.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. define("dojox/grid/_RowSelector", [
  2. "dojo/_base/declare",
  3. "./_View"
  4. ], function(declare, _View){
  5. return declare('dojox.grid._RowSelector', _View, {
  6. // summary:
  7. // Custom grid view. If used in a grid structure, provides a small selectable region for grid rows.
  8. defaultWidth: "2em",
  9. noscroll: true,
  10. padBorderWidth: 2,
  11. buildRendering: function(){
  12. this.inherited('buildRendering', arguments);
  13. this.scrollboxNode.style.overflow = "hidden";
  14. this.headerNode.style.visibility = "hidden";
  15. },
  16. getWidth: function(){
  17. return this.viewWidth || this.defaultWidth;
  18. },
  19. buildRowContent: function(inRowIndex, inRowNode){
  20. var w = this.contentWidth || 0;
  21. 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>';
  22. },
  23. renderHeader: function(){
  24. },
  25. updateRow: function(){
  26. },
  27. resize: function(){
  28. this.adaptHeight();
  29. },
  30. adaptWidth: function(){
  31. // Only calculate this here - rather than every call to buildRowContent
  32. if(!("contentWidth" in this) && this.contentNode){
  33. this.contentWidth = this.contentNode.offsetWidth - this.padBorderWidth;
  34. }
  35. },
  36. // styling
  37. doStyleRowNode: function(inRowIndex, inRowNode){
  38. var n = [ "dojoxGridRowbar dojoxGridNonNormalizedCell" ];
  39. if(this.grid.rows.isOver(inRowIndex)){
  40. n.push("dojoxGridRowbarOver");
  41. }
  42. if(this.grid.selection.isSelected(inRowIndex)){
  43. n.push("dojoxGridRowbarSelected");
  44. }
  45. inRowNode.className = n.join(" ");
  46. },
  47. // event handlers
  48. domouseover: function(e){
  49. this.grid.onMouseOverRow(e);
  50. },
  51. domouseout: function(e){
  52. if(!this.isIntraRowEvent(e)){
  53. this.grid.onMouseOutRow(e);
  54. }
  55. }
  56. });
  57. });