Show TOC

Example documentationi5Command Example

 

The HTML snippet for i5Command is as follows:

Syntax Syntax

  1. <!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()"/>
End of the code.

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 Syntax

  1. 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>
End of the code.

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 Syntax

  1. <HTML>
  2. <SCRIPT>
  3. 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);
    }
  4. </SCRIPT>
  5. <BODY>
  6. <input type="button" value="Click" onclick="updateGrid()"/>
  7. </BODY>
  8. </HTML>
End of the code.