i5Command Example
The HTML snippet for i5Command is as follows:
Syntax
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>i5Command - with Audit</TITLE>
<META http-equiv="X-UA-Compatible" content="IE=edge">
<META http-equiv='cache-control' content='no-cache'>
<META http-equiv='expires' content='0'>
<META http-equiv='pragma' content='no-cache'>
<SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid,i5SPCChart,i5Command">
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT>
var d = new com.sap.xmii.grid.init.i5Grid("i061926/iCommand/i5Grid", "i061926/iCommand/Select");
d.draw("Grid");
function creation(){
alert("creation event triggered");
}
function callback(){
alert("new row inserted in SQL DB. Now updating grid...!");
d.update(true);
}
var c = new com.sap.xmii.chart.hchart.i5Command("i061926/iCommand/Select","i061926/iCommand/iCommand",creation);
c.registerCommandCompletionEventHandler(callback);
c.registerCreationEventHandler(creation);
function executeComm(){
c.executeCommand();
}
</SCRIPT>
<div id="Grid"></div>
<input type="button" value="ExecuteCommand" onclick="executeComm()"/>If you have a query template, display template, and if you have enabled Audit
option, you must include the command completion Event as following:
Syntax
var d = new com.sap.xmii.grid.init.i5Grid("Default/iCommand/i5Grid", "Default/iCommand/Select");
d.draw("Grid");
function callback(){
d.update(true);
}
var c = new com.sap.xmii.chart.hchart.i5Command("Default/iCommand/XacuteQuery","Default/iCommand/iComm3");
c.registerCommandCompletionEventHandler(callback);
function updateGrid(){
c.executeCommand();
}
</SCRIPT>
<div id="Grid"></div>
<input type="button" value="Click" onclick="updateGrid()"/>
</BODY>
</HTML>If you have a query template and if you have not enabled Audit
, then Callback registration is not required and grid updation is as follows:
Syntax
<HTML><SCRIPT>var d = new com.sap.xmii.grid.init.i5Grid("Default/iCommand/i5Grid", "Default/iCommand/Select");
d.draw("Grid");
var c = new com.sap.xmii.chart.hchart.i5Command("Default/iCommand/XacuteQuery");
function updateGrid(){
c.executeCommand();
d.update(true);
}</SCRIPT><BODY><input type="button" value="Click" onclick="updateGrid()"/></BODY></HTML>