Select to view content in your preferred language

Hyperlink Script Dialog

1053
4
10-11-2011 06:13 AM
KateLyndegaard
Deactivated User
Hi there,

We have a widget in our web app that returns results in a datagrid. We do not have access to the source code, and the "Comments" field populates the grid in a single line (which can be quite long). As a work around, I am wondering if there is a way to click the attribute info in the "Comments" field (I can make the field a hyperlink field) and run a script from the hyperlink script dialog to pop open a window displaying the "Comments" attribute info (same info that was clicked).

The hyperlink script dialog accepts JScript and VBScript, however I'm unsure how to approach this.

Any suggestions would be appreciated,
Kate.
0 Kudos
4 Replies
HemingZhu
Frequent Contributor
Hi there,

We have a widget in our web app that returns results in a datagrid. We do not have access to the source code, and the "Comments" field populates the grid in a single line (which can be quite long). As a work around, I am wondering if there is a way to click the attribute info in the "Comments" field (I can make the field a hyperlink field) and run a script from the hyperlink script dialog to pop open a window displaying the "Comments" attribute info (same info that was clicked).

The hyperlink script dialog accepts JScript and VBScript, however I'm unsure how to approach this.

Any suggestions would be appreciated,
Kate.


One approach you can try is covert the Comments field into a hyperlink in datagrid using formatter property. Basically set formatter to a javascript function that will create html hyperlink string with comments. So when the datagrid is loaded, it will convert that string to html hyperlink element. The following code snippets convert a field value into a button, the implementation should be very similiar.
...
<div style="width: 650px; height: 400px">
  <table id="billsGrid" dojoType="dojox.grid.DataGrid" sortInfo="2">
     <thead>
       <tr>
          <th field="ConflictID" formatter="makeviewButton" width="20px">View feature</th>
          <th field="Oid" width="150px">OID</th>
    <th field="InVersion" width="150px">Version</th>
          <th field="ChangeType" width="150px">Change Type</th>    
       </tr>
     </thead>
  </table>
 </div>
...

<script type="text/javascript">
dojo.ready(function() {
 var conflictCollection ={"items":[{"InVersion":"GDP_OWN.DataEditing_1","ChangeType":"Delete","Oid":4614,"ConflictID":"1-4614-GDP_OWN.DataEditing_1"},{"InVersion":"GDP_OWN.DataEditing_2","ChangeType":"Update","Oid":4614,"ConflictID":"2-4614-GDP_OWN.DataEditing_2"}]};

 var dataStore = new dojo.data.ItemFileReadStore({ data:conflictCollection });
 var grid = dijit.byId("billsGrid");
 grid.setStore(dataStore);
});

function makeviewButton(id){
      
      var strArray =id.split("-");
      var oid =strArray[1];
      var version =strArray[2];
       var vBtn = "<div dojoType='dijit.form.Button'><img src='view.png'";
      vBtn = vBtn + " width='18' height='18'";
      vBtn = vBtn + " onClick=\"viewRow("+oid+", '"+version +"')\"></div>";
      //alert(vBtn);
      return vBtn;
}
function viewRow(oid, version)
{
 alert("oid=" +oid +"; version="+version);
}
</script>
0 Kudos
KateLyndegaard
Deactivated User
That's a fantastic solution, and I'd like to try it however I don't have access to the code that loads the datagrid. I was wondering if I could concatenate field values for a particular record with a blank popup to provide a url for a hyperlink??

Thanks again,
Kate.
0 Kudos
KateLyndegaard
Deactivated User
That's a fantastic solution, and I'd like to try it; however I don't have access to the datagrid code. I was wondering if there was any way to hyperlink field comments to open a pop up window containing the same comments.

Thanks again,
Kate.
0 Kudos
HemingZhu
Frequent Contributor
That's a fantastic solution, and I'd like to try it; however I don't have access to the datagrid code. I was wondering if there was any way to hyperlink field comments to open a pop up window containing the same comments.

Thanks again,
Kate.


Another approach would be attach "onRowClick" event on datagrid to get id of that feature and then open a pop up to show comments. However, I am not sure you could even do that if you have no access to the datagrid code.
0 Kudos