def callBackCreateUrl(self, dstColIndex, scriptName, extraCols=None, fixedParams=None):
"""
:param dstColIndex: The index of the main column with the hyperlink
:param scriptName: The script name to be called
:param extraCols: The list with the extra columns Index to be added to the URL
:return:
"""
url = render_template_string('''{{ url_for('ares.run_report', report_name='%s', script_name='%s') }}''' % (self.aresObj.reportName, scriptName))
xtraParams = ''
if fixedParams is not None:
xtraParams = "&%s" % "&".join(fixedParams)
self.callBacks('createdRow', '''
var content = $('td', row).eq(%(colIndex)s).html() ;
var extraCols = %(extraCols)s ; var header = %(header)s ; var colsVar = [] ; var contentUrl = content;
if (extraCols != null) {
for (var item in extraCols) {
var colNum = extraCols[item]; colsVar.push(header[colNum].key + "=" + $('td', row).eq(colNum).html())} ;
contentUrl = content + "&" + colsVar.join('&') ;}
contentUrl = contentUrl + '%(xtraParams)s' ;
$('td', row).eq(%(colIndex)s).html("<a href='%(url)s?%(col)s="+ contentUrl + "'>" + content + "</a>")
''' % {'colIndex': dstColIndex, 'extraCols': json.dumps(extraCols), 'header': json.dumps(self.header[-1]),
'xtraParams': xtraParams, 'url': url, 'col': self.recKey(self.header[-1][dstColIndex])})
评论列表
文章目录