﻿// Copyright 2007 by Developer Utility
// Please see http://www.developerutility.com/Terms.htm for terms of use.

function DemoGrid2(oEle) {
  try {
    // Write friendly message of execution
    oEle.value = "Please Wait";
     
    // Get the xml head template of our database candidate table
    var xmlGrid = GetXmlDoc("Demo2DataCandidatesTableHead.xml");
    
    // Initiate the Grid Marshall object - xml head template only, always empty body (your database rows = 0)
    var oTable = BuildGrid(xmlGrid);
    
    // Get the current grid object
    var oNodeHead = xmlGrid.selectSingleNode(xPathQueryHead);
    var currentGridID = oNodeHead.getAttribute("id"); // you can also get the gridID with the "oTable.id" property
    var currentGrid = arrGridMarshall[currentGridID];
    
    // Refresh the grid data (and paging if necessary)
    var pageSelect = 1        // always "1" when grid refresh
    var refreshDirection = 2; // always "2" when grid refresh
    
    // Append the grid body (your database rows) with the default filter
    RefreshGrid(currentGrid, pageSelect, refreshDirection);
    
    // Write friendly message of execution
    oEle.value = "Demonstration Completed";
    oEle.style.display = "none";
    
    // Display grid in browser
    var demo = document.getElementById("demo2");
    demo.style.display = "block";
    
  } catch(e) { 
      StatusBarWrite("Error (fnc : " + "DemoGrid2" + "). " + e.message, 3000);
    }
}
