2011-05-13 35 views
0

我正在顯示來自dojox.grid.DataGrid中的htmlStore表的數據。我希望在某些數據單元中有html內容(錨點 - href)。我試圖在htmlStore表格中對錨點進行硬編碼,但顯然這是非常低效的。來自htmlStore的dojox網格中的html內容

我被指示使用htmlStore。我的首選是使用ItemFileWriteStore,然後我可以在關聯的json文件中硬編碼url。

下面的佈局代碼。提前致謝!


      dojo.require("dojox.data.HtmlStore"); 
      dojo.require("dojox.grid.DataGrid"); 
       // set the layout structure: 
       var layoutDash = [ 

       [{ 
        field: 'Order ID', 
        name: 'Order ID', 
        width: '56px' 
       }, 
       { 
        field: 'Opportunity ID', 
        name: 'Opportunity ID', 
        width: '110px' 
       }, 
       { 
        field: 'Opportunity Name', 
        name: 'Opportunity Name', 
        width: '170px' 
       }, 
       { 
        field: 'Customer', 
        name: 'Customer', 
        width: '210px' 
       }, 
       { 
        field: 'Sales Rep', 
        name: 'Sales Rep', 
        width: '80px' 
       }, 
       { 
        field: 'Stage/Status', 
        name: 'Stage/Status', 
        width: '100px' 
       }, 
       { 
        field: 'Last Modified', 
        name: 'Last Modified', 
        width: '90px' 
       }, 
       { 
        field: 'Actions', 
        name: 'Actions', 
        width: 'auto', 
        editable: 'true' 
       }]]; 

回答

0

已解決。我創建一個格式化程序「actionsURL」並將其添加到grid.cell。


    { 
     field: 'Actions', 
     name: 'Actions', 
     width: 'auto', 
     editable: 'true', 
     formatter: actionsUrl 
    }]]; 

然後在佈局代碼下面添加了該函數。

重要。閱讀,如果你打算使用這種技術:應該有一個HTML錨點封裝返回值「編輯」在單引號。它只是沒有顯示在我的演示代碼中。

    
     function actionsUrl() { 
      return 'Edit'; 
     }