开发者

jqgrid change pointer to hand

I want to change the pointer to hand when hovering over jqgrid's rows Is there an API for tha开发者_JAVA技巧t?


This can be done more easily using the classes colModel property as below:

{ name: 'Email', index: 'Email', classes: 'pointer' }

From the wiki:

This option allow to add classes to the column. If more than one class will be used a space should be set. By example classes:'class1 class2' will set a class1 and class2 to every cell on that column. In the grid css there is a predefined class ui-ellipsis which allow to attach ellipsis to a particular row. Also this will work in FireFox too.


I just add this into my css file

#mygrid .jqgrow{
    cursor:pointer;
}


Use a custom formatter on any cell in the grid. For more info on these, see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter

Here's how I did it. I wanted the first column in my grid to appear like it is a clickable link (but really it triggers a custom jqgrid event, onCellSelect).

Snippet of my grid object:

colModel :[ 
{name:'ticket', index:'IMINDT', width:125, formatter: pointercursor}, 

pointercursor is a function name. The code for it is defined like this:

// Custom formatter for a cell in a jqgrid row. 
function pointercursor(cellvalue, options, rowObject)
{ 
var new_formatted_cellvalue = '<span class="pointer">' + cellvalue + '</span>'; 
return new_formatted_cellvalue; 
} 

My CSS class of "pointer" is:

.pointer { 
cursor: pointer; 
text-decoration: underline;
}    

That's it!


in css file put this:

  .ui-jqgrid .ui-jqgrid-btable { cursor : pointer; }


It seems to me that you have not a jqgrid question, but pure CSS or javascript question. Look at How to get cursor to change before mouse moves when changing the cursor style dynamically for example. It shows how can one change cursor style of a html element. See also in http://www.quirksmode.org/css/cursor.html, that 'hand' is supported not in all browsers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜