Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.1/processing-api.min.js"></script>
 <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojox/grid/resources/Grid.css">
  <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
  <div id="gridDiv" style="width:400px;height:400px;"></div>
  
</body>
</html>
 
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
dojo.addOnLoad(function() {
    var data = 
        { "head": 
            { 
            "vars": [ "s" , "fname" , "lname" ] } , 
            "results": {
            "bindings": [    
            { 
            "s":{"type": "uri1" , "value": "41" },
            "fname": { "type": "literal" , "value": "Gayathri" } , 
            "lname": { "type": "literal" , "value": "Vasudevan" } 
            } ,   
            { 
           "s":{"type": "uri6" , "value": "39" },
           "fname": { "type": "literal" , "value": "Magesh" } ,
           "lname": { "type": "literal" , "value": "Vasudevan" } 
            },   
            { 
            "s":{"type": "uri27" , "value": "text" },
            "fname": { "type": "literal" , "value": "Yahoo" } ,
            "lname": { "type": "literal" , "value": "VHoodlum" } 
             },   
            { 
           "s":{"type": "uri6" , "value": "39" },
           "fname": { "type": "literal" , "value": "Magesh" } ,
           "lname": { "type": "literal" , "value": "Vasudevan" } 
            },   
            { 
           "s":{"type": "uri6" , "value": "39" },
           "fname": { "type": "literal" , "value": "Magesh" } ,
           "lname": { "type": "literal" , "value": "Vasudevan" } 
            },
              { 
           "s":{"type": "uri6" , "value": "39" },
           "fname": { "type": "literal" , "value": "Magesh" } ,
           "lname": { "type": "literal" , "value": "Vasudevan" } 
            }
              ] 
             } 
        };
  
  var urlColmn = 'AnotherGrid';
  var items = dojo.map(data.results.bindings, function(binding) {
    return {
      fname : binding.fname.value, 
      lname : binding.lname.value, 
      s: binding.s.value
    };
  });
  
  
  var store =  new dojo.data.ItemFileReadStore({
    data : {
      items : items
    }
  });
  
 
   var layout = [[
      { field : "fname", name : "First Name", width : "33%"},
      { field : "lname", name : "Last Name", width : "33%" },
     { field : "s", name : "url", width : "33%", formatter:"Integer"}
    ]];
  
  var grid = new dojox.grid.DataGrid({
      store : store,
      structure : layout,
      rowsPerPage: 10
   });
  
  function _createGrid(store) {
       grid.placeAt("gridDiv");
       grid.update();
        grid.startup();
    return grid;
  }
 
  _createGrid(store);
  
  
});
dojo.addOnLoad(function() {
  var data_items = {"committees":[{"cname":"test data","office":"","term":"2015"}],"boardcertifications":[{"area":"Bustion","year":"2012"},{"area":"Conaw","year":"2005"},{"area":"Cl","year":"2013"}],"sections":[{"sname":"Real Property, Probate Law"},{"sname":"Trial Lawyers"}]};
  
  
  var d_iems_committees = 
      dojo.map(data_items.committees,function(resultSet)
  {
    return {     
            cname: resultSet.cname,
            office: resultSet.office,
            term: resultSet.term
           };
  });
  var d_data = 
  {   
    items: d_iems_committees
  };
  
  var d_store = new dojo.data.ItemFileReadStore({
    identifier: 'cname',
    data: d_data  
  });
  
  var d_layout = [[
    {'name': 'Committee name', 'field': 'cname', 'width': '200px'},
     {'name': 'Office', 'field': 'type', 'width': '50px'},
     {'name': 'Term', 'field': 'term', 'width': '50px'}
  ]];
  var d_grid = new dojox.grid.DataGrid({
      store : d_store,
      structure : d_layout,
      rowsSelector: '20px'
   });
  function _createGrid2(d_store) {
       d_grid.placeAt("gridDiv2");
       d_grid.update();
       d_grid.startup();
    return d_grid;
  }
 
  _createGrid2(d_store);
  
  var d_iems_board = 
      dojo.map(data_items.boardcertifications,function(bcResultSet)
  {
    return {     
            area: bcResultSet.area,
            year: bcResultSet.year
           };
  });
  
});
   
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers