我这个showUrl该怎么写呢,救助,小弟不胜感激

解决方案 »

  1.   


    {
        header: "财务名称",
        dataIndex: "reportname",
        renderer: function (v) {
            if (v != "") {
                return "<a href='" + v + "'>" + v + "</a>";
            } else {
                return "";
            }
        }
    }
    这样不行吗,你看看renderer中的alert下看执行了没
      

  2.   

    大哥们,你们没听明白我的意思,像你的那个参数"v"他指的是财务名称 也就是v的值也就是财务名称,可我的超连接的href的值要的是别的列,也就是报表模块路径,哎郁闷了我一整天了
      

  3.   

    我明白了,当前的v是中文名称。也就是链接显示字符串,还有路径。你要的是路径,可以通过当前data获得的吧。我要下班了,明天给你研究。
      

  4.   

    晕,在这里又遇到你了,要的是不是这样  function showUrl(value, cellmeta, record, rowIndex, columnIndex, store) {
    return "<a herf='+ record.data.reportLocation+'>" + value + "</a>";
      }
      

  5.   

    我丢。引号又错了。function showUrl(value, cellmeta, record, rowIndex, columnIndex, store) {
    return "<a herf='" + record.data.reportLocation + "'>" + value + "</a>";
    }注意value, cellmeta, record, rowIndex, columnIndex, store六个参数的位置。
      

  6.   


    改变数据源,将财务名称这个数据。改成财务名称+报表模块路径,报表模块路径不变。这样就可以截取value的值了。java:
    public void doPost(request, response) {
        String json = "";
        json += "reportid:" + getReportId(); 
        json += ",typename:'" + getTypeName() + "'";
        json += ....;
        json += ",reportname: '" + getReportName() + "@" + getReportLocation() + "'";
        json += ....;
        json += ",reportlocation:'" + getReportLocation() + "'";
        json += ....;
        out.print(json);
    }{
        header: "财务名称",
        dataIndex: "reportname",
        renderer: function (value) {
            if (v != "") {
                var ary = value.split('@');//现在这里对应的是:json += ",reportname: '" + getReportName() + "@" + getReportLocation() + "'";
                                           //所以用@分割,就是reportname和reportLocation了
                return "<a href='" + ary[0] + "'>" + ary[1] + "</a>";
            } else {
                return "";
            }
        }
    }只需要传递3个参数,因为只用到了record,后面没有用到的可以忽略不传
    function showUrl(value, cellmeta, record) {
        return "<a herf='" + record.data.reportLocation + "'>" + value + "</a>";
    }