CSV

Initial Data

As initial data we'll take 3 books:

  • “War and Peace” by Leo Tolstoy
  • “Hamlet” by William Shakespeare
  • “Madame Bovary” by Gustave Flaubert

Configuration

In CSV the data will look as:

books.csv

War and Peace, Leo Tolstoy
Hamlet, Shakespeare
Madame Bovary, Gustave Flaubert

Data in CSV hasn’t got names for values. Values are accessible as (“data0”, “data1”, …).

HTML Code

list(csv).html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
	<head>
	<link rel="stylesheet" href="../../../codebase/touchui.css" type="text/css" media="screen" charset="utf-8">
		<script src="../../../codebase/touchui.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
              <script type="text/javascript" charset="utf-8">
 
	      dhx.ui({
                    view:"list",
                    data:"War and Peace, Leo Tolstoy \n Hamlet, Shakespeare \n Madame Bovary, Gustave Flaubert",  
                    datatype:"csv",
		    template:"#data0#(#data1#)", 
                    select:true, 
                    type: {width: 300}
              });    
	      </script>
 
	</body>
</html>

If you use data from external file - remove the data parameter and add url, where specify the desired data file.

dhx.ui({
                    view:"list",
                    url:"books.csv", 
                    datatype:"csv",
		    template:"#data0#(#data1#)", 
                    select:true, 
                    type: {width: 300}
});