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>