2017-12-28 24 views
0

wiqlを使用して読み込まれたバグのリストを含むグリッドを返す独自のVSTS拡張機能を作成しました。VSTS拡張 - グリッドソース内のハイパーリンク

(UIコントロール)グリッドにバグのタイトルとハイパーリンクを追加して、バグにジャンプするタイトルをクリックすることができますようにします。私はそれを行う可能性を見つけることができませんでしたが、私はそれが不可能ではないとは考えていません。

これは私がグリッドに私のソースを構築しています方法です:

var sourceArray = workItems.map(function (w) { 
     return [ 
      w.id, 
      w.fields["System.Title"], 
      w.fields["System.State"], 
      w.fields["GrundfosScrum.gfSeverity"], 
      w.fields["GrundfosScrum.gfLikelihood"], 
      w.fields["System.AssignedTo"]]; 
    }); 

以降:

var options = { 
     width: "100%", 
     height: "500px", 
     source: sourceArray, 
     columns: [ 
      { text: "ID", index: 0, width: 100, headerCss: "mystyle" }, 
      { text: "Title", index: 1, width: 200, headerCss: "mystyle" }, 
      { text: "State", index: 2, width: 100, headerCss: "mystyle" }, 
      { text: "Severity", index: 3, width: 200, headerCss: "mystyle" }, 
      { text: "Likelihood", index: 4, width: 200, headerCss: "mystyle" }, 
      { text: "Assigned To", index: 5, width: 300, headerCss: "mystyle" }, 
     ] 
    }; 

私はw.fields["System.Title"].link(w.url)w.fields["System.Title"]を交換しようとし、結果は表内のHTMLのハイパーリンクでしたグリッド内のハイパーリンクの代わりに。

アイデア?

+0

アイデアはありますか?それとも単にサポートされていないのですか? –

答えて

0

グリッド内のリンクを追加するとサポートされません。しかし、Open row detailsメソッドを呼び出して、あなたが望む機能を実現することができます。 URL情報を取得し、openRowDetailメソッドがトリガーされたときに新しいウィンドウを開きます。

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title>Open Row Sample</title> 
    <script src="sdk/scripts/VSS.SDK.js"></script> 
</head> 
<body> 
    <script type="text/javascript"> 
     VSS.init({ 
      explicitNotifyLoaded: true, 
      usePlatformScripts: true, 
      usePlatformStyles: true  
     }); 
    </script> 
    <h1>Open Row Sample</h1> 
    <div id="grid-container"></div> 
    <script type="text/javascript"> 
    VSS.require(["VSS/Controls", "VSS/Controls/Grids"], 
    function (Controls, Grids) { 
    var dataSource = []; 
    dataSource.push({key: "VisualStudio", value: "https://www.visualstudio.com/"}); 
    dataSource.push({key: "Bing", value: "https://www.bing.com/"}); 

    var grid = Controls.create(Grids.Grid, $("#grid-container"), { 
     height: "1000px", 
     columns: [ 
      { text: "Property key", index: "key", width: 150 }, 
      { text: "Property value", index: "value", width: 600 } 
     ], 
     source: dataSource, 
     openRowDetail: (index) => { 
     var info = grid.getRowData(index); 
     window.open(info.value); 
    } 
    }); 
    VSS.notifyLoadSucceeded(); 
    }); 
    </script> 
</body> 
</html> 
+0

ありがとうございます。あなたが与えた例は、TypeScripteを使って構文を示しています。 JavaScriptを使用した例を教えてください。 –

+0

@wolf_guru例とほぼ同じです。詳細については、私の更新答えを見てください。 –

+0

ありがとうman:o)。 –

関連する問題