{"id":279,"date":"2010-03-23T08:39:13","date_gmt":"2010-03-23T16:39:13","guid":{"rendered":"http:\/\/www.dhtmlx.com\/blog\/?p=279"},"modified":"2026-10-23T12:16:53","modified_gmt":"2026-10-23T09:16:53","slug":"dhtmlxdataview","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/dhtmlxdataview\/","title":{"rendered":"Introducing dhtmlxDataView: Flexible, Easy, Multipurpose"},"content":{"rendered":"<p>Have you ever been faced with a need to display objects with the same set of properties and behavior? I&#8217;m sure you have. Lists of contacts, sets of documents or files, product catalogs for online stores, image collections, etc.<\/p>\n<p>When we first tried to create a solution to simplify this task, we ended up with dhtmlxFolders. Now we&#8217;ve moved further in our efforts to make the component more flexible and easier to use,  and we developed <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxDataView\/\" target=\"_blank\">dhtmlxDataView<\/a>.<\/p>\n<p><strong>What is dhtmlxDataView?<\/strong><\/p>\n<p>dhtmlxDataView is a JavaScript component that shows a collection of objects according to a certain template. Each object is rendered as a container with fixed sizes. The layout of properties in a container depends on the template that you&#8217;ve defined. For now, it is the most flexible component from the DHTMLX product line. You can control any visual aspect of rendering.<\/p>\n<p><a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxDataView\/\" target=\"_blank\"><div id=\"attachment_288\" style=\"width: 609px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-288\" class=\"size-full wp-image-288\" title=\"DV1_\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV1_.png\" alt=\"dhtmlxDataView - Example\" width=\"599\" height=\"447\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV1_.png 599w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV1_-300x223.png 300w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><p id=\"caption-attachment-288\" class=\"wp-caption-text\">dhtmlxDataView - Example<\/p><\/div><\/a><\/p>\n<p><!--more--><strong>Supported Operations<\/strong><\/p>\n<p>The component supports all necessary operations with objects:<\/p>\n<ul>\n<li>Adding and deleting objects (simple, complex, with any set of custom properties)<\/li>\n<li>Selection (single, multi, group)<\/li>\n<li>In-line editing<\/li>\n<li>Drag-and-drop of objects:\n<ul>\n<li>inside dataView<\/li>\n<li>between DataView and dhtmlxGrid or dhtmlxTree<\/li>\n<li>between DataView and any HTML container<\/li>\n<\/li>\n<\/ul>\n<\/ul>\n<p>&nbsp;<br \/>\n<strong>Performance with a Large Number of Objects<\/strong><\/p>\n<p>There is no limitation on the number of objects which can be put into the DataView. Smart rendering, paging, and dynamic loading allow you to display hundreds or thousands of objects and still have an interface with fast performance. You even don\u2019t need to know what smart-rendering is \u2013 this mode is fully transparent and will be enabled automatically when lots of items are loaded.<\/p>\n<p>dhtmlxDataView supports a connector class (now only for PHP, but upon final release, it will be extended to Java and .NET), so as with other DHTMLX components, you will be able to use automatic data-rendering \/ data-saving from a defined SQL source.<\/p>\n<p><strong>How to Use<\/strong><\/p>\n<p>DataView is rather easy to use. You can set common or individual designs for objects, their editors and tooltips through HTML templates. Just write an HTML snippet that defines how you want to see the object. You can also choose any appropriate way of loading data: JSON, XML, JavaScript array, HTML, or CSV.<\/p>\n<p>Check out the following brief example.<\/p>\n<p>Let\u2019s assume that we need to display information about software packages: package name, version, maintainer, and description. First of all, we need to include two files: dhtmlxdataview.js and dhtmlxdataview.css<\/p>\n<div class=\"codecolorer-container html4strict default codecolorer-noborder\" style=\"\"><div class=\"html4strict codecolorer\"><span class=\"sc2\">&lt;<span class=\"kw2\">script<\/span> <span class=\"kw3\">src<\/span><span class=\"sy0\">=<\/span>\u201d.<span class=\"sy0\">\/<\/span><span class=\"kw3\">codebase<\/span><span class=\"sy0\">\/<\/span>dhtmlxdataview.js\u201d &gt;&lt;<span class=\"sy0\">\/<\/span><span class=\"kw2\">script<\/span>&gt;<\/span><br \/>\n<span class=\"sc2\">&lt;<span class=\"kw2\">link<\/span> <span class=\"kw3\">rel<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;stylesheet&quot;<\/span> <span class=\"kw3\">href<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;.\/codebase\/dhtmlxdataview.css\u201d type=&quot;<\/span><span class=\"kw3\">text<\/span><span class=\"sy0\">\/<\/span>css<span class=\"st0\">&quot; charset=&quot;<\/span>utf-<span class=\"nu0\">8<\/span><span class=\"st0\">&quot;&gt;<\/span><\/span><\/div><\/div>\n<p>After that, place a container where you want to show the data:<\/p>\n<div class=\"codecolorer-container html4strict default codecolorer-noborder\" style=\"\"><div class=\"html4strict codecolorer\">&lt;<span class=\"kw2\">div<\/span> <span class=\"kw3\">id<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;data_container&quot;<\/span> <span class=\"kw3\">style<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">&quot;border:1px solid #A4BED4; background-color:white;width:460px;height:200px;&quot;<\/span>&gt;&lt;<span class=\"sy0\">\/<\/span><span class=\"kw2\">div<\/span>&gt;<\/div><\/div>\n<p>And the final accord is JavaScript initialization:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> view <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhtmlXDataView<span class=\"br0\">&#40;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; container<span class=\"sy0\">:<\/span><span class=\"st0\">&quot;data_container&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"co1\">\/\/where data will be rendered<\/span><br \/>\n&nbsp; &nbsp; edit<span class=\"sy0\">:<\/span><span class=\"kw2\">true<\/span><span class=\"sy0\">,<\/span> &nbsp; <span class=\"co1\">\/\/allows data edit<\/span><br \/>\n&nbsp; &nbsp; type<span class=\"sy0\">:<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/how data will look<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; template<span class=\"sy0\">:<\/span><span class=\"st0\">&quot;{obj.Package} : {obj.Version}&lt;br\/&gt;;{obj.Maintainer}&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/how editor will look<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; template_edit<span class=\"sy0\">:<\/span><span class=\"st0\">&quot;&lt;textarea class='dhx_item_editor' bind='obj.Version'&gt;&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; width<span class=\"sy0\">:<\/span> <span class=\"nu0\">200<\/span><span class=\"sy0\">,<\/span> &nbsp;<span class=\"co1\">\/\/width of single item<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; height<span class=\"sy0\">:<\/span><span class=\"nu0\">40<\/span> &nbsp;<span class=\"co1\">\/\/height of single item<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; tooltip<span class=\"sy0\">:<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co1\">\/\/how tooltip for the item will look<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; template<span class=\"sy0\">:<\/span><span class=\"st0\">&quot;&lt;b&gt;{obj.Package}&lt;b&gt;&lt;br&gt;{obj.Description}&quot;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#125;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\nview.<span class=\"me1\">load<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;data.json&quot;<\/span><span class=\"sy0\">,<\/span><span class=\"st0\">&quot;json&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span> &nbsp; <span class=\"co1\">\/\/load data from json<\/span><\/div><\/div>\n<p>Here is what we\u2019ve got:<\/p>\n<div id=\"attachment_281\" style=\"width: 477px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-281\" class=\"size-full wp-image-281\" title=\"dhtmlxDataView Example - Package List\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV2.PNG\" alt=\"dhtmlxDataView Example - Package List\" width=\"467\" height=\"403\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV2.PNG 467w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV2-300x258.PNG 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><p id=\"caption-attachment-281\" class=\"wp-caption-text\">dhtmlxDataView Example - Package List<\/p><\/div>\n<p>It\u2019s a DataView with 2 items in a row (if the item width were smaller, there would be more items per row). Version numbers of packages are set as editable. Users can double click on a corresponding item and type in a new package version. These changes can be easily saved in the database by DataProcessor. Besides, items can be added or deleted dynamically with the ability to reflect changes on the server.<\/p>\n<p>In our example, only package version is editable (bind=\u2019obj.Version\u2019), but it\u2019s possible to define more than one editor using an HTML template. For example, if you want to edit a package name too, just place an additional input in template_edit.<\/p>\n<p><strong>What&#8217;s More<\/strong><\/p>\n<p>Items in DataView can contain not only plain text, but any custom HTML that you define in your templates, including links, images, etc. Therefore the component can be useful if you need to display multiple items within a single container, like an image viewer or a files browser:<\/p>\n<div id=\"attachment_293\" style=\"width: 477px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-293\" class=\"size-full wp-image-293\" title=\"DV2_\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV2_.PNG\" alt=\"dhtmlxDataView Example - File Browser\" width=\"467\" height=\"403\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV2_.PNG 467w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV2_-300x258.PNG 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><p id=\"caption-attachment-293\" class=\"wp-caption-text\">dhtmlxDataView Example - File Browser<\/p><\/div>\n<p>\u2026or a product catalog:<\/p>\n<div id=\"attachment_294\" style=\"width: 477px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-294\" class=\"size-full wp-image-294\" title=\"DV4_\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV4_.PNG\" alt=\"dhtmlxDataView Example - Product Catalog\" width=\"467\" height=\"371\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV4_.PNG 467w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2010\/03\/DV4_-300x238.PNG 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><p id=\"caption-attachment-294\" class=\"wp-caption-text\">dhtmlxDataView Example - Product Catalog<\/p><\/div>\n<p>dhtmlxDataView provides a handy tool to build an item viewer with less effort and time. It makes you believe that there are easy solutions for even troublesome programming tasks. <\/p>\n<p><small>Posted by Alexandra Klenova<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever been faced with a need to display objects with the same set of properties and behavior? I&#8217;m sure you have. Lists of contacts, sets of documents &#8230;<\/p>\n","protected":false},"author":2,"featured_media":3374,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,70,1],"tags":[33,18,14],"class_list":["post-279","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-posts-for-codeproject-com","category-releases","category-uncategorized","tag-all-posts","tag-labs","tag-tips"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/comments?post=279"}],"version-history":[{"count":4,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/279\/revisions"}],"predecessor-version":[{"id":16055,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/279\/revisions\/16055"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/3374"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}