Data in Grid (Table) from XML file : JavaScript DHTML examples (example source code) » GUI Components » Table Grid

JavaScript DHTML














Java Products
Java Articles
JavaScript DHTML Home  »   GUI Components   » [  Table Grid  ]   

 
Data in Grid (Table) from XML file

Please note that some example is only working under IE or Firefox.

<html>
<head>
  <title>ActiveWidgets Grid :: Examples</title>
  <style> body, html {margin:0px; padding: 0px; overflow: hidden;</style>

  <!-- ActiveWidgets stylesheet and scripts -->
  <link href="gridRuntime/styles/classic/grid.css" rel="stylesheet" type="text/css" ></link>
  <script src="gridRuntime/lib/grid.js"></script>

  <!-- grid format -->
  <style>
    .active-controls-grid {height: 100%; font: menu;}

    .active-column-{width:  80px;}
    .active-column-{width: 200px; background-color: threedlightshadow;}
    .active-column-{text-align: right;}
    .active-column-{text-align: right;}
    .active-column-{text-align: right;}
    .active-column-{text-align: right;}

    .active-grid-column {border-right: 1px solid threedshadow;}
    .active-grid-row {border-bottom: 1px solid threedlightshadow;}
  </style>
</head>
<body>
  <script>

  //  create data formats
  var string = new Active.Formats.String;
  var number1 = new Active.Formats.Number;
  var number2 = new Active.Formats.Number;
  var date = new Active.Formats.Date;

  //  define formatting rule for text output
  number1.setTextFormat("#,###.##");
  number2.setTextFormat("");

  date.setTextFormat("dd mmm yy");
  date.setDataFormat("ISO8061");

  //  create ActiveWidgets data model - XML-based table
  var table = new Active.XML.Table;

  //  provide data URL
  table.setURL("gridExamples/data/companies-array.xml");

  //  define namespace for selecting column data
  table.setNamespace("co""http://tempuri.org/");

  //  set column XPath
  table.setColumns(["co:ticker""co:name""co:marketcap""co:sales""co:employees""co:timestamp"]);

  //  set column formatting
  table.setFormats([string, string, number1, number1, number2, date]);

  //  start asyncronous data retrieval
  table.request();

  //  define column labels
  var columns = ["Ticker""Company Name""Market Cap.""$ Sales""Employees""Date"];

  //  create ActiveWidgets Grid javascript object
  var obj = new Active.Controls.Grid;

  //  provide column labels
  obj.setColumnProperty("texts", columns);

  //  provide external model as a grid data source
  obj.setDataModel(table);

  //  write grid html to the page
  document.write(obj);

  </script>
</body>
</html>


Download: ActiveWidgets.zip   (344  K)  
Related examples in the same category
1.  List box Grid Table
2.  List view Selection between two list
3.  Basic Grid Table
4.  Grid Table with colored cells
5.  Build a Grid Table from CSV data file
6.  Build a Grid Tree from a tab separated file
7.  Build a Grid Table from yahoo quotes IE only
8.  Grid Table with image in cells
9.  Grid Table with multiple selection
10.  Grid Table with row header and tooltips
11.  One page two grid Table
12.  Grid Table with Data Island and Column highlight
13.  Grid Table with cell format and XML data set
14.  Grid Table data from RSS IE only
15.  Grid Table data from xml file 2
16.  Grid Table with news feeder IE only
17.  Grid Table with quotes feeder IE only
18.  Grid Table in Unix style
19.  Sortable Grids table
20.  Selectable Cells Grid Table
21.  Editable Grid Table cell
22.  Call back action in Grid Table
23.  Table Grid Rows Selection
24.  Grid Table Columns Resize
25.  Table Grid Column Renderers
26.  Sorting for each column or double click to edit its contents.
27.  Table Grid style and sort the style
28.  Table in JavaScript
29.  Web Data Grid Table








Home| Contact Us
Copyright ?2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.