2010-11-16 61 views
1

我想使用qtip和jqgrid并根据jqgrid中选择的行显示不同的图像。图像的路径可以在jqgrid中作为隐藏单元格。我环顾四周,但无法找到任何文档,如果jqgrid有一个相关的行选择器可以使用。有没有人知道我想要的选择器,或者如果我应该尝试完全采用不同的方法?qtip jqgrid选择器问题

迄今为止工作的唯一选择器是在下面,但它是整个网格。我已经尝试了几件事情来指定行,但没有任何工作。任何帮助,将不胜感激。

$('#gridtable').qtip({ 
     content: 'Some text', 
     show: 'mouseover', 
     hide: 'mouseout', 
     position: { 
      corner: { 
      target: 'topLeft', 
      tooltip: 'bottomLeft' 
     } 
     } 
    }); 

回答

0

我的解决方案是在每个有葡萄酒图像的行中放置一个图标,并为其分配行的id。这意味着每行可以被赋予一个独特的类来悬停。不漂亮,但它的工作。

if((gridRow['photo'] != "false")) 
       { 

       $("#gridtable2").jqGrid('setRowData',i+1,{wine:'<div class ="imageicon'+i+'">'+ret['wine']+' <img src=\"images/icon-wine.png\" height="16" width="13"/></div>'}); 

       path = '<img src="images/winephotos/' 
       + gridRow['id'] 
       +'.jpg" width="350" height="450" alt="Wine Image"' 
       +' class="resize"/>'; 

       $('.imageicon'+i).qtip({ 
        content: $(path) 
         , 
         position: { 
          corner: { 
          target: 'topLeft', 
          tooltip: 'bottomLeft' 
          } 

        }, 
        show: { 
         when: 'click', 
         //ready: true, 
         solo: true 
        }, 
        hide: { 
         when: { 
          event: 'click', 
          event: 'mouseout' 
         } 
        }, 
        style: { 
         width: { max: 280 }, 
         name: 'dark' 
        } 
       }); 
       } 
       gridRow=false; 
      }