I use jqGrid with many columns containing logical information that appear as checkboxes inside the table (see http://www.ok-soft-gmbh.com/VerticalHeaders/TestFixedO.htm for an example). For a more compact display of information, I use vertical column headers. It works very well and works in jqGrid in all browsers (see My discussion with Tony Tomov on the jqGrid forum http://www.trirand.com/blog/?page_id=393/feature-request/headers-with-vertical-orientation / ), but in the vertical text, IE is blurry and doesn't look good enough (open the link above in IE, and you'll see exactly what I mean). I asked users why the text looks so weird. So I'm thinking of using a JavaScript-based SVG library such as SVG Web ( http://code.google.com/p/svgweb/ ) or Raphaël ( http://raphaeljs.com/ ). SVG is very powerful and hard to find a good example. I only need to display vertical text (-90 grad, from bottom to top) and use, if possible, without working in absolute positioning mode.
So, again, my question is: I need to be able to display vertical text (- 90 grad rotation ) inside the <td> of the table title elements. I want to use a JavaScript-based SVG library such as SVG Web or Raphaël. The solution should support IE6 . Does anyone have a good reference example that could help me? If someone sends a whole solution to the problem, I would be happy.
To be precise, this is my current solution: I define
.rotate { -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -o-transform: rotate(-90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)" ; }
define the RotateCheckboxColumnHeaders function
var RotateCheckboxColumnHeaders = function (grid, headerHeight) { // we use grid as context (if one have more as one table on tnhe page) var trHead = $("thead:first tr", grid.hdiv); var cm = grid.getGridParam("colModel"); $("thead:first tr th").height(headerHeight); headerHeight = $("thead:first tr th").height(); for (var iCol = 0; iCol < cm.length; iCol++) { var cmi = cm[iCol]; if (cmi.formatter === 'checkbox') { // we must set width of column header div BEFOR adding class "rotate" to // prevent text cutting based on the current column width var headDiv = $("th:eq(" + iCol + ") div", trHead); headDiv.width(headerHeight).addClass("rotate"); if (!$.browser.msie) { if ($.browser.mozilla) { headDiv.css("left", (cmi.width - headerHeight) / 2 + 3).css("bottom", 7); } else { headDiv.css("left", (cmi.width - headerHeight) / 2); } } else { var ieVer = jQuery.browser.version.substr(0, 3); // Internet Explorer if (ieVer !== "6.0" && ieVer !== "7.0") { headDiv.css("left", cmi.width / 2 - 4).css("bottom", headerHeight / 2); $("span", headDiv).css("left", 0); } else { headDiv.css("left", 3); } } } } };
And include a call like RotateCheckboxColumnHeaders(grid, 110); after creating jqGrid.
javascript jquery svg jqgrid
Oleg Apr 24 '10 at 16:15 2010-04-24 16:15
source share