{"id":50,"date":"2008-07-01T09:11:01","date_gmt":"2008-07-01T17:11:01","guid":{"rendered":"http:\/\/www.dhtmlx.com\/blog\/?p=49"},"modified":"2023-05-09T12:31:55","modified_gmt":"2023-05-09T09:31:55","slug":"grid-gears","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/grid-gears\/","title":{"rendered":"Grid + Gears = ?"},"content":{"rendered":"<p><em>Translated from original posted on www.monoxrom.net<\/em><\/p>\n<p>I&#8217;ve been trying to have a look at Google Gears in action, but always had some other fish to fry. You can hardly expect a user to agree on implementing some off-site plug-in developing a simple web-page. But if it is about developing for the Intranet, it doesn&#8217;t come out to be anything like a serious problem.<\/p>\n<p>Still less chance a user has to implement an off-site plug-in in the Intranet. But if the boss wants it, so &#8220;keep quiet and drive&#8221; :)<\/p>\n<p>Initially we have: a file with tabular data (an Excel file, in practice).<br \/>\nRequired output: a changes-friendly interface for a remote user.<\/p>\n<p>The most trivial solution &#8211; to use ready-made online services (for example, Google Spreadsheet) &#8211; doesn&#8217;t meet the case, unfortunately (authorization is required, and it is laced with some (un)healthy paranoia).<br \/>\nThe second simple approach is using one of ready-made grid-like solutions, to which Google Gears can be attached for additional comfort.<\/p>\n<p><!--more--><strong>Step One &#8211; Toolkit Preparation<\/strong><\/p>\n<p>Let&#8217;s reject purely commercial components at once. They also have their own niche in real life but in this case their usage is not reasonable.<\/p>\n<p>There are three good solutions among open-source components: extJS Grid, dhtmlxGrid, DOJO Grid (the first two of them are produced under double licenses: GPL | Commercial, the third one has BSD-like license).<\/p>\n<p>ExtJS &#8211; All other things being equal, it has the largest amount of necessary files and some performance problems working with huge datasets.<\/p>\n<blockquote><p>The unclear situation with its licensing policy reduces the desire of using it (the moral aspect of project development under GPL which further on was shifted to a tougher license is on developer&#8217;s head).<br \/>\nLet&#8217;s leave making a smaller build for people who have more spare time.<\/p><\/blockquote>\n<p>DOJO grid &#8211; It seems to be ok, but there&#8217;s no certainty about it due to absence of documentation.<\/p>\n<p>dhtmlxGrid &#8211; the amount of code is relatively small, its examples and documentation, and, the main thing, working speed make this component our best card.<\/p>\n<blockquote><p>We&#8217;ll take it, wrap up two, please.<\/p><\/blockquote>\n<p>We use a <em>highly classified<\/em> Excel file as a data source (in further examples, this highly classified Excel file will be replaced by an unclassified one obtained with the help of freebase.com &#8211; but it was deprecated).<br \/>\nLet&#8217;s convert it into CVS to simplify further development.<\/p>\n<blockquote><p>I adore office packets: you save the file as &#8220;data with a separator , &#8220;, and get &#8220;data with a separator ; &#8221; &#8211; such a slight misunderstanding. But saving was done, at least it&#8217;s something.<\/p><\/blockquote>\n<p>Thus, settled: <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxGrid\/\">dhtmlxGrid<\/a> + data<\/p>\n<p><strong>Step Two &#8211; Data Loading<\/strong><\/p>\n<p>When we have the required toolkit in hand, we can get down to practice.<br \/>\nAs a first step we render grid and populate it with data &#8211; prototype.<\/p>\n<p>The initialization code is relatively simple:<\/p>\n<ol id=\"s:3c7\">\n<li id=\"s:3c8\" style=\"color: black\">\n<p id=\"s:3c9\"><span id=\"s:3c10\" style=\"color: #009900\"><em id=\"h.nl\">\/\/create a grid object <\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c11\" style=\"color: black\">\n<p id=\"s:3c12\">\u00a0grid =\u00a0 <span id=\"s:3c13\" style=\"color: #003366\"><strong id=\"h.nl0\">new<\/strong><\/span> dhtmlXGridObject<span id=\"s:3c14\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c15\" style=\"color: #3366cc\">\u2018for_grid\u2019<\/span><span id=\"s:3c16\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"s:3c17\" style=\"color: black\">\n<p id=\"s:3c18\"><span id=\"s:3c19\" style=\"color: #009900\"><em id=\"h.nl1\">\/\/set columns names<br id=\"f2tz\" \/><\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c20\" style=\"color: black\">\n<p id=\"s:3c21\">\u00a0grid.<span id=\"s:3c22\" style=\"color: #006600\">setHeader<\/span><span id=\"s:3c23\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c24\" style=\"color: #3366cc\">&#8220;Name,Manufacturer,Format,Horizontal Resolution,Vertical Resolution,Digital zoom,Compressed Formats,Viewfinder type,LCD resolution,Weight (g),Width,Height,Depth,Also known as,Web Link&#8221;<\/span><span id=\"s:3c25\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"s:3c26\">\n<p id=\"s:3c27\"><span id=\"s:3c28\" style=\"color: #009900\"><em id=\"h.nl2\">\/\/set columns width<\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c29\" style=\"color: black\">\n<p id=\"s:3c30\">\u00a0grid.<span id=\"s:3c31\" style=\"color: #006600\">setInitWidths<\/span><span id=\"s:3c32\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c33\" style=\"color: #3366cc\">&#8220;300,100,100,100,100,100,100,100,100,100,<br \/>\n100,100,100,200,300&#8243;<\/span><span id=\"s:3c34\" style=\"color: #66cc66\">)<\/span><\/li>\n<li id=\"s:3c35\" style=\"color: black\">\n<p id=\"s:3c36\"><span id=\"s:3c37\" style=\"color: #009900\"><em id=\"h.nl3\">\/\/render grid<\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c38\" style=\"color: black\">\n<p id=\"s:3c39\">grid.<span id=\"s:3c40\" style=\"color: #006600\">init<\/span><span id=\"s:3c41\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c42\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"s:3c43\" style=\"color: black\">\n<p id=\"s:3c44\"><span id=\"s:3c45\" style=\"color: #009900\"><em id=\"h.nl4\">\/*inform grid that input data has ready-made IDs and there&#8217;s no need to worry about them <\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c46\">\n<p id=\"s:3c47\"><span id=\"s:3c48\" style=\"color: #009900\"><em id=\"h.nl5\">ready-made IDs are not typical for CSV|Excel &#8211; but we&#8217;re lucky at this point*\/<\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c49\" style=\"color: black\">\n<p id=\"s:3c50\">\u00a0grid.<span id=\"s:3c51\" style=\"color: #006600\">enableCSVAutoID<\/span><span id=\"s:3c52\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c53\" style=\"color: #003366\"><strong id=\"h.nl6\">false<\/strong><\/span><span id=\"s:3c54\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"s:3c55\" style=\"color: black\">\n<p id=\"s:3c56\"><span id=\"s:3c57\" style=\"color: #009900\"><em id=\"h.nl7\">\/\/set data separator in CSV<\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c58\" style=\"color: black\">\n<p id=\"s:3c59\">\u00a0grid.<span id=\"s:3c60\" style=\"color: #006600\">csv<\/span>.<span id=\"s:3c61\" style=\"color: #006600\">cell<\/span>=<span id=\"s:3c62\" style=\"color: #3366cc\">&#8220;;&#8221;<\/span><\/p>\n<\/li>\n<li id=\"s:3c63\" style=\"color: black\">\n<p id=\"s:3c64\"><span id=\"s:3c65\" style=\"color: #009900\"><em id=\"h.nl8\">\/\/make grid a little more attractive<\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c66\">\n<p id=\"s:3c67\">\u00a0grid.<span id=\"s:3c68\" style=\"color: #006600\">setSkin<\/span><span id=\"s:3c69\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c70\" style=\"color: #3366cc\">&#8220;modern&#8221;<\/span><span id=\"s:3c71\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"s:3c72\" style=\"color: black\">\n<p id=\"s:3c73\"><span id=\"s:3c74\" style=\"color: #009900\"><em id=\"h.nl9\">\/\/load data<\/em><\/span><\/p>\n<\/li>\n<li id=\"s:3c75\" style=\"color: black\">\n<p id=\"s:3c76\">\u00a0grid.<span id=\"s:3c77\" style=\"color: #006600\">load<\/span><span id=\"s:3c78\" style=\"color: #66cc66\">(<\/span><span id=\"s:3c79\" style=\"color: #3366cc\">&#8220;data.csv&#8221;<\/span>,<span id=\"s:3c80\" style=\"color: #3366cc\">&#8220;csv&#8221;<\/span><span id=\"s:3c81\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<\/ol>\n<p><small><\/small><\/p>\n<p>It&#8217;s not that the amount of code is small, but there is no useless commands &#8211; everything is to the point. Grid is being rendered, data is being loaded, default settings allow to edit it, but everything is done not so quickly.<\/p>\n<blockquote><p>Initially a file with 1000 lines was used in tests. In the example above it was replaced by a file with 200 lines &#8211; using a 300kb file in a post is not very humane :) &#8211; that&#8217;s why the difference in loading speed is not so notable. Believe my word, the difference will be much more visible in case of 1000 lines.<\/p><\/blockquote>\n<p>Now that it can be fixed pretty easily by adding one command to the initializing code:<\/p>\n<p id=\"opru4\">Code (javascript)<\/p>\n<ol id=\"opru5\">\n<li id=\"opru6\" style=\"color: black\">\n<p id=\"opru7\">grid.<span id=\"opru8\" style=\"color: #006600\">enableSmartRendering<\/span><span id=\"opru9\" style=\"color: #66cc66\">(<\/span><span id=\"opru10\" style=\"color: #003366\"><strong id=\"h.nl10\">true<\/strong><\/span><span id=\"opru11\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<\/ol>\n<p>And we get the same example, but the data is now being rendered nearly instantly &#8211; prototype<\/p>\n<blockquote><p>At a closer look it&#8217;s obvious that only two lines were changed in the code, one more JS file was added in addition to the command itself.<br \/>\nIn case of dhtmlxgrid &#8211; more functionality means more included files, in contrast with extJs&#8217;s approach which initially includes everything in the core.<\/p><\/blockquote>\n<p><strong>Step Three &#8211; Saving Changes<\/strong><\/p>\n<p>We have data, it can be edited, there&#8217;s only one little thing left &#8211; to save it.<\/p>\n<blockquote><p>In theory there&#8217;s a possibility in dhtmlxgrid to integrate with server code, but this opportunity is included only into the PRO version. That&#8217;s why it&#8217;s time for a workaround.<\/p><\/blockquote>\n<p>In order not to complicate the thing that is already simple, we add a &#8220;Save&#8221; button, a click on which transforms the grid back to CSV and sends it to the server:<\/p>\n<p id=\"y:iv135\">Code (javascript)<\/p>\n<ol id=\"y:iv136\">\n<li id=\"y:iv137\" style=\"color: black\">\n<p id=\"y:iv138\"><span id=\"y:iv139\" style=\"color: #003366\"><strong id=\"fj:l11\">function<\/strong><\/span> save_data<span id=\"y:iv140\" style=\"color: #66cc66\">(<\/span><span id=\"y:iv141\" style=\"color: #66cc66\">)<\/span><span id=\"y:iv142\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"y:iv143\" style=\"color: black\">\n<p id=\"y:iv144\">\u00a0 document.<span id=\"y:iv145\" style=\"color: #006600\">forms<\/span><span id=\"y:iv146\" style=\"color: #66cc66\">[<\/span><span id=\"y:iv147\" style=\"color: #cc0000\">0<\/span><span id=\"y:iv148\" style=\"color: #66cc66\">]<\/span>.<span id=\"y:iv149\" style=\"color: #006600\">data<\/span>.<span id=\"y:iv150\" style=\"color: #006600\">value<\/span>=grid.<span id=\"y:iv151\" style=\"color: #006600\">serializeToCSV<\/span><span id=\"y:iv152\" style=\"color: #66cc66\">(<\/span><span id=\"y:iv153\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"y:iv154\" style=\"color: black\">\n<p id=\"y:iv155\">\u00a0 document.<span id=\"y:iv156\" style=\"color: #006600\">forms<\/span><span id=\"y:iv157\" style=\"color: #66cc66\">[<\/span><span id=\"y:iv158\" style=\"color: #cc0000\">0<\/span><span id=\"y:iv159\" style=\"color: #66cc66\">]<\/span>.<span id=\"y:iv160\" style=\"color: #006600\">submit<\/span><span id=\"y:iv161\" style=\"color: #66cc66\">(<\/span><span id=\"y:iv162\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"y:iv163\" style=\"color: black\">\n<p id=\"y:iv164\"><span id=\"y:iv165\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<\/ol>\n<p>At the same time we add a couple of code lines to make the changed data noticeable:<\/p>\n<p id=\"y:iv168\">\u00a0Code (javascript)<\/p>\n<ol id=\"y:iv169\">\n<li id=\"y:iv170\" style=\"color: black\">\n<p id=\"y:iv171\">\u00a0grid.<span id=\"y:iv172\" style=\"color: #006600\">attachEvent<\/span><span id=\"y:iv173\" style=\"color: #66cc66\">(<\/span><span id=\"y:iv174\" style=\"color: #3366cc\">&#8220;onEditCell&#8221;<\/span>,<span id=\"y:iv175\" style=\"color: #003366\"><strong id=\"fj:l12\">function<\/strong><\/span><span id=\"y:iv176\" style=\"color: #66cc66\">(<\/span>stage,id,ind<span id=\"y:iv177\" style=\"color: #66cc66\">)<\/span><span id=\"y:iv178\" style=\"color: #66cc66\">{<\/span> <span id=\"y:iv179\" style=\"color: #009900\"><em id=\"fj:l13\">\/\/in case of editing<\/em><\/span><\/p>\n<\/li>\n<li id=\"y:iv180\" style=\"color: black\">\n<p id=\"y:iv181\">\u00a0 <span id=\"y:iv182\" style=\"color: #000066\"><strong id=\"fj:l14\">if<\/strong><\/span> <span id=\"y:iv183\" style=\"color: #66cc66\">(<\/span>stage==<span id=\"y:iv184\" style=\"color: #cc0000\">2<\/span><span id=\"y:iv185\" style=\"color: #66cc66\">)<\/span> <span id=\"y:iv186\" style=\"color: #009900\"><em id=\"fj:l15\">\/\/ when it is finished<\/em><\/span><\/p>\n<\/li>\n<li id=\"y:iv187\" style=\"color: black\">\n<p id=\"y:iv188\">\u00a0\u00a0 grid.<span id=\"y:iv189\" style=\"color: #006600\">setRowTextStyle<\/span><span id=\"y:iv190\" style=\"color: #66cc66\">(<\/span>id,<span id=\"y:iv191\" style=\"color: #3366cc\">&#8220;font-weight:bold;&#8221;<\/span><span id=\"y:iv192\" style=\"color: #66cc66\">)<\/span>; <span id=\"y:iv193\" style=\"color: #009900\"><em id=\"fj:l16\">\/\/ mark the line<\/em><\/span><\/p>\n<\/li>\n<li id=\"y:iv194\" style=\"color: black\">\n<p id=\"y:iv195\"><strong>\u00a0\u00a0 <\/strong><span id=\"y:iv196\" style=\"color: #000066\"><strong id=\"fj:l17\">return<\/strong><\/span> <span id=\"y:iv197\" style=\"color: #003366\"><strong id=\"fj:l18\">true<\/strong><\/span>;<\/p>\n<\/li>\n<li id=\"y:iv198\">\n<p id=\"y:iv199\">\u00a0<span id=\"y:iv200\" style=\"color: #66cc66\">}<\/span><span id=\"y:iv201\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<\/ol>\n<p>Everything is simpler on the server side:<\/p>\n<p id=\"y:iv204\">Code (php)<\/p>\n<ol id=\"y:iv205\">\n<li id=\"y:iv206\" style=\"color: black\">\n<p id=\"y:iv207\"><span id=\"y:iv208\" style=\"color: #b1b100\">if<\/span> <span id=\"y:iv209\" style=\"color: #66cc66\">(<\/span>isset<span id=\"y:iv212\" style=\"color: #66cc66\">(<\/span><span id=\"y:iv213\" style=\"color: #0000ff\">$_POST<\/span><span id=\"y:iv214\" style=\"color: #66cc66\">[<\/span><span id=\"y:iv215\" style=\"color: #ff0000\">&#8220;data&#8221;<\/span><span id=\"y:iv216\" style=\"color: #66cc66\">]<\/span><span id=\"y:iv217\" style=\"color: #66cc66\">)<\/span><span id=\"y:iv218\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"y:iv219\" style=\"color: black\">\n<p id=\"y:iv220\">\u00a0file_put_contents<span id=\"y:iv221\" style=\"color: #66cc66\">(<\/span><span id=\"y:iv222\" style=\"color: #ff0000\">&#8220;data.csv&#8221;<\/span>,<span id=\"y:iv223\" style=\"color: #0000ff\">$_POST<\/span><span id=\"y:iv224\" style=\"color: #66cc66\">[<\/span><span id=\"y:iv225\" style=\"color: #ff0000\">&#8220;data&#8221;<\/span><span id=\"y:iv226\" style=\"color: #66cc66\">]<\/span><span id=\"y:iv227\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<\/ol>\n<blockquote><p>Authorization code is omitted.<br \/>\nNaturally, such approach of overwriting the data source is too straight and doesn&#8217;t have right to exist in real life. But why not at the stage of prototype?<\/p><\/blockquote>\n<p>With all these changes introduced we have the next version of the prototype that can load data, allows to edit data and saves the result on the server (it took me much more time to describe the process rather than to create the prototype).<\/p>\n<p><strong>Step Four &#8211; Google Gears Enters the Game<\/strong><\/p>\n<p>Now when everything works, we can think of some useful ingredients.<br \/>\nData saving is one of the things that seem obvious. In my personal experience, data loss is the nastiest thing that may happen (network connection loss, program error, some accidentally pressed button &#8211; losing is much easier than creating).<\/p>\n<p>In case of using Google Gear, you can store all the information on client&#8217;s side. Then if a page is reloaded or even closed, the data won&#8217;t be lost. During your next visit the data can be restored out of the local storage.<\/p>\n<p>Unlike grid, Gears&#8217;s initialization and configuring are troublesome.<br \/>\nAs a first step we need to install Gears and create a database.<\/p>\n<p>Code (javascript)<\/p>\n<ol id=\"hnfl9\">\n<li id=\"hnfl10\" style=\"color: black\">\n<p id=\"hnfl11\">&nbsp;<\/p>\n<\/li>\n<li id=\"hnfl12\" style=\"color: black\">\n<p id=\"hnfl13\">\u00a0<span id=\"hnfl14\" style=\"color: #009900\"><em id=\"i7ex\">\/\/check the availability of Google Gears; if it is not installed, everything will operate without any changes<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl15\" style=\"color: black\">\n<p id=\"hnfl16\">\u00a0<span id=\"hnfl17\" style=\"color: #000066\"><strong id=\"i7ex0\">if<\/strong><\/span> <span id=\"hnfl18\" style=\"color: #66cc66\">(<\/span>!window.<span id=\"hnfl19\" style=\"color: #006600\">google<\/span><span id=\"hnfl20\" style=\"color: #66cc66\">)<\/span> <span id=\"hnfl21\" style=\"color: #000066\"><strong id=\"i7ex1\">return<\/strong><\/span> <span id=\"hnfl22\" style=\"color: #000066\">alert<\/span><span id=\"hnfl23\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl24\" style=\"color: #3366cc\">&#8220;The page requires Google Gears <span id=\"hnfl25\" style=\"color: #000099\"><strong id=\"i7ex2\">\\n<\/strong><\/span> It will work without it as well, but you will not be able to work offline.&#8221;<\/span><span id=\"hnfl26\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl27\" style=\"color: black\">\n<p id=\"hnfl28\">\u00a0<span id=\"hnfl29\" style=\"color: #009900\"><em id=\"i7ex3\">\/\/if Google Gears is installed, we create a local database<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl30\">\n<p id=\"hnfl31\">\u00a0db = google.<span id=\"hnfl32\" style=\"color: #006600\">gears<\/span>.<span id=\"hnfl33\" style=\"color: #006600\">factory<\/span>.<span id=\"hnfl34\" style=\"color: #006600\">create<\/span><span id=\"hnfl35\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl36\" style=\"color: #3366cc\">\u2018beta.database\u2019<\/span><span id=\"hnfl37\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl38\" style=\"color: black\">\n<p id=\"hnfl39\">&nbsp;<\/p>\n<\/li>\n<li id=\"hnfl40\" style=\"color: black\">\n<p id=\"hnfl41\">\u00a0<span id=\"hnfl42\" style=\"color: #009900\"><em id=\"i7ex4\">\/\/check database creation. Gears requests user&#8217;s permission and the user can well deny the operation<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl43\" style=\"color: black\">\n<p id=\"hnfl44\"><span id=\"hnfl45\" style=\"color: #000066\"><strong id=\"i7ex5\">\u00a0if<\/strong><\/span> <span id=\"hnfl46\" style=\"color: #66cc66\">(<\/span>db<span id=\"hnfl47\" style=\"color: #66cc66\">)<\/span> <span id=\"hnfl48\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"hnfl49\" style=\"color: black\">\n<p id=\"hnfl50\">\u00a0<span id=\"hnfl51\" style=\"color: #009900\"><em id=\"i7ex6\">\/\/create the required table, we set all the fields as <\/em><\/span><span id=\"hnfl51\" style=\"color: #009900\"><em id=\"i7ex6\">varchar(255)<\/em><\/span><span id=\"hnfl51\" style=\"color: #009900\"><em id=\"i7ex6\"> to avoid any mess<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl52\">\n<p id=\"hnfl53\"><em>\u00a0<\/em><span id=\"hnfl54\" style=\"color: #009900\"><em id=\"i7ex7\">\/\/a table field is created for each column in grid, plus one additional field &#8211; updated &#8211; that will save the status of data lines<br id=\"bkli\" \/><\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl55\" style=\"color: black\">\n<p id=\"hnfl56\">\u00a0db.<span id=\"hnfl57\" style=\"color: #000066\">open<\/span><span id=\"hnfl58\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl59\" style=\"color: #3366cc\">\u2018gearsgrid\u2019<\/span><span id=\"hnfl60\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl61\" style=\"color: black\">\n<p id=\"hnfl62\">\u00a0 db.<span id=\"hnfl63\" style=\"color: #006600\">execute<\/span><span id=\"hnfl64\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl65\" style=\"color: #3366cc\">\u2018create table if not exists photodata (pkID varchar(255), Name varchar(255), Manufacturer varchar(255), Format varchar(255), Horizontal varchar(255), Vertical varchar(255), Zoom varchar(255), Compressed varchar(255), Viewfinder varchar(255), LCD varchar(255), Weight varchar(255), Width varchar(255), Height varchar(255), Depth varchar(255), Known varchar(255), Link varchar(255), updated int)\u2019<\/span><span id=\"hnfl66\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl67\" style=\"color: black\">\n<p id=\"hnfl68\">&nbsp;<\/p>\n<\/li>\n<li id=\"hnfl69\" style=\"color: black\">\n<p id=\"hnfl70\"><em>\u00a0<\/em><span id=\"hnfl71\" style=\"color: #009900\"><em id=\"i7ex8\">\/\/check whether there is data in the database or it is the first loading<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl72\">\n<p id=\"hnfl73\"><strong>\u00a0<\/strong><span id=\"hnfl74\" style=\"color: #003366\"><strong id=\"i7ex9\">var<\/strong><\/span> rs = db.<span id=\"hnfl75\" style=\"color: #006600\">execute<\/span><span id=\"hnfl76\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl77\" style=\"color: #3366cc\">\u2019select count(*) from photodata\u2019<\/span><span id=\"hnfl78\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl79\" style=\"color: black\">\n<p id=\"hnfl80\"><em>\u00a0<\/em><span id=\"hnfl81\" style=\"color: #009900\"><em id=\"i7ex10\">\/\/if the data is not loaded yet <\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl82\" style=\"color: black\">\n<p id=\"hnfl83\"><strong>\u00a0<\/strong><span id=\"hnfl84\" style=\"color: #000066\"><strong id=\"i7ex11\">if<\/strong><\/span> <span id=\"hnfl85\" style=\"color: #66cc66\">(<\/span>rs.<span id=\"hnfl86\" style=\"color: #006600\">field<\/span><span id=\"hnfl87\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl88\" style=\"color: #cc0000\">0<\/span><span id=\"hnfl89\" style=\"color: #66cc66\">)<\/span>==<span id=\"hnfl90\" style=\"color: #cc0000\">0<\/span><span id=\"hnfl91\" style=\"color: #66cc66\">)<\/span><span id=\"hnfl92\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"hnfl93\" style=\"color: black\">\n<p id=\"hnfl94\"><em>\u00a0 <\/em><span id=\"hnfl95\" style=\"color: #009900\"><em id=\"i7ex12\">\/\/create the query and get the data<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl96\" style=\"color: black\">\n<p id=\"hnfl97\"><strong>\u00a0 <\/strong><span id=\"hnfl98\" style=\"color: #003366\"><strong id=\"i7ex13\">var<\/strong><\/span> request = google.<span id=\"hnfl99\" style=\"color: #006600\">gears<\/span>.<span id=\"hnfl100\" style=\"color: #006600\">factory<\/span>.<span id=\"hnfl101\" style=\"color: #006600\">create<\/span><span id=\"hnfl102\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl103\" style=\"color: #3366cc\">\u2018beta.httprequest\u2019<\/span><span id=\"hnfl104\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl105\">\n<p id=\"hnfl106\">\u00a0\u00a0 request.<span id=\"hnfl107\" style=\"color: #000066\">open<\/span><span id=\"hnfl108\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl109\" style=\"color: #3366cc\">\u2018GET\u2019<\/span>, <span id=\"hnfl110\" style=\"color: #3366cc\">\u2018data.csv?uid=\u2019<\/span>+<span id=\"hnfl111\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl112\" style=\"color: #003366\"><strong id=\"i7ex14\">new<\/strong><\/span> Date<span id=\"hnfl113\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl114\" style=\"color: #66cc66\">)<\/span><span id=\"hnfl115\" style=\"color: #66cc66\">)<\/span>.<span id=\"hnfl116\" style=\"color: #006600\">valueOf<\/span><span id=\"hnfl117\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl118\" style=\"color: #66cc66\">)<\/span><span id=\"hnfl119\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl120\" style=\"color: black\">\n<p id=\"hnfl121\">\u00a0\u00a0 request.<span id=\"hnfl122\" style=\"color: #006600\">onreadystatechange<\/span> = <span id=\"hnfl123\" style=\"color: #003366\"><strong id=\"i7ex15\">function<\/strong><\/span><span id=\"hnfl124\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl125\" style=\"color: #66cc66\">)<\/span> <span id=\"hnfl126\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"hnfl127\" style=\"color: black\">\n<p id=\"hnfl128\">\u00a0\u00a0\u00a0 <span id=\"hnfl129\" style=\"color: #000066\"><strong id=\"i7ex16\">if<\/strong><\/span> <span id=\"hnfl130\" style=\"color: #66cc66\">(<\/span>request.<span id=\"hnfl131\" style=\"color: #006600\">readyState<\/span> == <span id=\"hnfl132\" style=\"color: #cc0000\">4<\/span><span id=\"hnfl133\" style=\"color: #66cc66\">)<\/span><span id=\"hnfl134\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"hnfl135\" style=\"color: black\">\n<p id=\"hnfl136\">\u00a0\u00a0\u00a0 <span id=\"hnfl137\" style=\"color: #009900\"><em id=\"i7ex17\">\/\/split the derived CSV file into lines<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl138\" style=\"color: black\">\n<p id=\"hnfl139\"><strong>\u00a0\u00a0\u00a0\u00a0 <\/strong><span id=\"hnfl140\" style=\"color: #003366\"><strong id=\"i7ex18\">var<\/strong><\/span> data=request.<span id=\"hnfl141\" style=\"color: #006600\">responseText<\/span>.<span id=\"hnfl142\" style=\"color: #006600\">split<\/span><span id=\"hnfl143\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl144\" style=\"color: #3366cc\">&#8220;<span id=\"hnfl145\" style=\"color: #000099\"><strong id=\"i7ex19\">\\n<\/strong><\/span>&#8220;<\/span><span id=\"hnfl146\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl147\">\n<p id=\"hnfl148\"><strong>\u00a0\u00a0\u00a0\u00a0 <\/strong><span id=\"hnfl149\" style=\"color: #000066\"><strong id=\"i7ex20\">for<\/strong><\/span> <span id=\"hnfl150\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl151\" style=\"color: #003366\"><strong id=\"i7ex21\">var<\/strong><\/span> i=<span id=\"hnfl152\" style=\"color: #cc0000\">0<\/span>; i &lt; data.<span id=\"hnfl153\" style=\"color: #006600\">length<\/span>; i++<span id=\"hnfl154\" style=\"color: #66cc66\">)<\/span><span id=\"hnfl155\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"hnfl156\" style=\"color: black\">\n<p id=\"hnfl157\"><em>\u00a0\u00a0\u00a0\u00a0 <\/em><span id=\"hnfl158\" style=\"color: #009900\"><em id=\"i7ex22\">\/\/split the lines into columns<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl159\" style=\"color: black\">\n<p id=\"hnfl160\"><strong>\u00a0\u00a0\u00a0\u00a0 <\/strong><span id=\"hnfl161\" style=\"color: #003366\"><strong id=\"i7ex23\">var<\/strong><\/span> fields=data<span id=\"hnfl162\" style=\"color: #66cc66\">[<\/span>i<span id=\"hnfl163\" style=\"color: #66cc66\">]<\/span>.<span id=\"hnfl164\" style=\"color: #006600\">split<\/span><span id=\"hnfl165\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl166\" style=\"color: #3366cc\">&#8220;;&#8221;<\/span><span id=\"hnfl167\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"hnfl168\" style=\"color: black\">\n<p id=\"hnfl169\">\u00a0\u00a0\u00a0\u00a0 <span id=\"hnfl170\" style=\"color: #009900\"><em id=\"i7ex24\">\/\/set the reloading flag to 0 <br id=\"exti\" \/><\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl171\" style=\"color: black\">\n<p id=\"hnfl172\">\u00a0\u00a0\u00a0\u00a0 fields.<span id=\"hnfl173\" style=\"color: #006600\">push<\/span><span id=\"hnfl174\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl175\" style=\"color: #cc0000\">0<\/span><span id=\"hnfl176\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"hnfl177\">\n<p id=\"hnfl178\">\u00a0\u00a0\u00a0\u00a0 <span id=\"hnfl179\" style=\"color: #009900\"><em id=\"i7ex25\">\/\/save in the local database<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl180\" style=\"color: black\">\n<p id=\"hnfl181\">\u00a0\u00a0\u00a0\u00a0 db.<span id=\"hnfl182\" style=\"color: #006600\">execute<\/span><span id=\"hnfl183\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl184\" style=\"color: #3366cc\">&#8220;insert into photodata values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)&#8221;<\/span>,fields<span id=\"hnfl185\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl186\" style=\"color: black\">\n<p id=\"hnfl187\">\u00a0\u00a0\u00a0\u00a0 <span id=\"hnfl188\" style=\"color: #66cc66\">}<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl189\" style=\"color: black\">\n<p id=\"hnfl190\"><em>\u00a0\u00a0\u00a0 <\/em><span id=\"hnfl191\" style=\"color: #009900\"><em id=\"i7ex26\">\/\/invoke the function of grid filling<\/em><\/span><\/p>\n<\/li>\n<li id=\"hnfl189\" style=\"color: black\"> <br id=\"qgv1\" \/><\/li>\n<li id=\"hnfl192\" style=\"color: black\">\n<p id=\"hnfl193\">\u00a0 \u00a0\u00a0 fill_grid<span id=\"hnfl194\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl195\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl196\">\n<p id=\"hnfl197\">\u00a0 \u00a0 <span id=\"hnfl198\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<li id=\"hnfl199\" style=\"color: black\">\n<p id=\"hnfl200\">\u00a0\u00a0 <span id=\"hnfl201\" style=\"color: #66cc66\">}<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl202\" style=\"color: black\">\n<p id=\"hnfl203\">\u00a0\u00a0 request.<span id=\"hnfl204\" style=\"color: #006600\">send<\/span><span id=\"hnfl205\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl206\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl207\" style=\"color: black\">\n<p id=\"hnfl208\">\u00a0<span id=\"hnfl209\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<li id=\"hnfl210\" style=\"color: black\">\n<p id=\"hnfl211\">\u00a0rs.<span id=\"hnfl212\" style=\"color: #000066\">close<\/span><span id=\"hnfl213\" style=\"color: #66cc66\">(<\/span><span id=\"hnfl214\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"hnfl215\">\n<p id=\"hnfl216\">\u00a0<span id=\"hnfl217\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<\/ol>\n<blockquote><p>If you don&#8217;t receive any data working with the object &#8220;request&#8221;, check the character encoding in the loaded document. If it is not Us-ASCII | Unicode, &#8220;request&#8221; will return null &#8211; such a nice peculiarity.<\/p><\/blockquote>\n<p>As promised &#8211; this code fragment came out to be fairly big, but it is not complicated. There&#8217;s just a lot of text in it.<\/p>\n<p>The Gears loaded the data into the local database, and now the grid can be populated with this data.<\/p>\n<p id=\"d1uf3\">Code (javascript)<\/p>\n<ol id=\"d1uf4\">\n<li id=\"d1uf5\" style=\"color: black\">\n<p id=\"d1uf6\">&nbsp;<\/p>\n<\/li>\n<li id=\"d1uf7\" style=\"color: black\">\n<p id=\"d1uf8\"><span id=\"d1uf9\" style=\"color: #003366\"><strong id=\"i7ex27\">function<\/strong><\/span> fill_grid<span id=\"d1uf10\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf11\" style=\"color: #66cc66\">)<\/span><span id=\"d1uf12\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"d1uf13\" style=\"color: black\">\n<p id=\"d1uf14\">\u00a0<span id=\"d1uf15\" style=\"color: #000066\"><strong id=\"i7ex28\">if<\/strong><\/span> <span id=\"d1uf16\" style=\"color: #66cc66\">(<\/span>db<span id=\"d1uf17\" style=\"color: #66cc66\">)<\/span><span id=\"d1uf18\" style=\"color: #66cc66\">{<\/span>\u00a0 \u00a0 \u00a0 \u00a0 <span id=\"d1uf19\" style=\"color: #009900\"><em id=\"i7ex29\">\/\/if there is Google Gears<\/em><\/span><\/p>\n<\/li>\n<li id=\"d1uf20\" style=\"color: black\">\n<p id=\"d1uf21\"><strong>\u00a0 <\/strong><span id=\"d1uf22\" style=\"color: #003366\"><strong id=\"i7ex30\">var<\/strong><\/span> data=<span id=\"d1uf23\" style=\"color: #66cc66\">[<\/span><span id=\"d1uf24\" style=\"color: #66cc66\">]<\/span>;<\/p>\n<\/li>\n<li id=\"d1uf25\">\n<p id=\"d1uf26\"><em>\u00a0 <\/em><span id=\"d1uf27\" style=\"color: #009900\"><em id=\"i7ex31\">\/\/choose the data<\/em><\/span><\/p>\n<\/li>\n<li id=\"d1uf28\" style=\"color: black\">\n<p id=\"d1uf29\"><strong>\u00a0 <\/strong><span id=\"d1uf30\" style=\"color: #003366\"><strong id=\"i7ex32\">var<\/strong><\/span> rs=db.<span id=\"d1uf31\" style=\"color: #006600\">execute<\/span><span id=\"d1uf32\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf33\" style=\"color: #3366cc\">&#8220;select * from photodata&#8221;<\/span><span id=\"d1uf34\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"d1uf35\" style=\"color: black\">\n<p id=\"d1uf36\">\u00a0\u00a0 <span id=\"d1uf37\" style=\"color: #009900\"><em id=\"i7ex33\">\/\/form the array of data for grid<\/em><\/span><\/p>\n<\/li>\n<li id=\"d1uf38\" style=\"color: black\">\n<p id=\"d1uf39\">\u00a0 <span id=\"d1uf40\" style=\"color: #000066\"><strong id=\"i7ex34\">while<\/strong><\/span> <span id=\"d1uf41\" style=\"color: #66cc66\">(<\/span>rs.<span id=\"d1uf42\" style=\"color: #006600\">isValidRow<\/span><span id=\"d1uf43\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf44\" style=\"color: #66cc66\">)<\/span><span id=\"d1uf45\" style=\"color: #66cc66\">)<\/span> <span id=\"d1uf46\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"d1uf47\" style=\"color: black\">\n<p id=\"d1uf48\">\u00a0 data.<span id=\"d1uf49\" style=\"color: #006600\">push<\/span><span id=\"d1uf50\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf51\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"d1uf52\">\n<p id=\"d1uf53\">\u00a0 id:rs.<span id=\"d1uf54\" style=\"color: #006600\">field<\/span><span id=\"d1uf55\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf56\" style=\"color: #cc0000\">0<\/span><span id=\"d1uf57\" style=\"color: #66cc66\">)<\/span>,<\/p>\n<\/li>\n<li id=\"d1uf58\" style=\"color: black\">\n<p id=\"d1uf59\">\u00a0\u00a0 data:<span id=\"d1uf60\" style=\"color: #66cc66\">[<\/span>rs.<span id=\"d1uf61\" style=\"color: #006600\">field<\/span><span id=\"d1uf62\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf63\" style=\"color: #cc0000\">1<\/span><span id=\"d1uf64\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf65\" style=\"color: #006600\">field<\/span><span id=\"d1uf66\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf67\" style=\"color: #cc0000\">2<\/span><span id=\"d1uf68\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf69\" style=\"color: #006600\">field<\/span><span id=\"d1uf70\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf71\" style=\"color: #cc0000\">3<\/span><span id=\"d1uf72\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf73\" style=\"color: #006600\">field<\/span><span id=\"d1uf74\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf75\" style=\"color: #cc0000\">4<\/span><span id=\"d1uf76\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf77\" style=\"color: #006600\">field<\/span><span id=\"d1uf78\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf79\" style=\"color: #cc0000\">5<br \/>\n<\/span><span id=\"d1uf80\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf81\" style=\"color: #006600\">field<\/span><span id=\"d1uf82\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf83\" style=\"color: #cc0000\">6<\/span><span id=\"d1uf84\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf85\" style=\"color: #006600\">field<\/span><span id=\"d1uf86\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf87\" style=\"color: #cc0000\">7<\/span><span id=\"d1uf88\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf89\" style=\"color: #006600\">field<\/span><span id=\"d1uf90\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf91\" style=\"color: #cc0000\">8<\/span><span id=\"d1uf92\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf93\" style=\"color: #006600\">field<\/span><span id=\"d1uf94\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf95\" style=\"color: #cc0000\">9<\/span><span id=\"d1uf96\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf97\" style=\"color: #006600\">field<\/span><span id=\"d1uf98\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf99\" style=\"color: #cc0000\">10<br \/>\n<\/span><span id=\"d1uf100\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf101\" style=\"color: #006600\">field<\/span><span id=\"d1uf102\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf103\" style=\"color: #cc0000\">11<\/span><span id=\"d1uf104\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf105\" style=\"color: #006600\">field<\/span><span id=\"d1uf106\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf107\" style=\"color: #cc0000\">12<\/span><span id=\"d1uf108\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf109\" style=\"color: #006600\">field<\/span><span id=\"d1uf110\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf111\" style=\"color: #cc0000\">13<\/span><span id=\"d1uf112\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf113\" style=\"color: #006600\">field<\/span><span id=\"d1uf114\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf115\" style=\"color: #cc0000\">14<\/span><span id=\"d1uf116\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"d1uf117\" style=\"color: #006600\">field<\/span><span id=\"d1uf118\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf119\" style=\"color: #cc0000\">15<\/span><span id=\"d1uf120\" style=\"color: #66cc66\">)<\/span><span id=\"d1uf121\" style=\"color: #66cc66\">]<\/span><span id=\"d1uf122\" style=\"color: #66cc66\">}<\/span><span id=\"d1uf123\" style=\"color: #66cc66\">)<\/span>;<\/li>\n<li id=\"d1uf124\" style=\"color: black\">\n<p id=\"d1uf125\">\u00a0 rs.<span id=\"d1uf126\" style=\"color: #006600\">next<\/span><span id=\"d1uf127\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf128\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"d1uf129\" style=\"color: black\">\n<p id=\"d1uf130\">\u00a0 <span id=\"d1uf131\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<li id=\"d1uf132\" style=\"color: black\">\n<p id=\"d1uf133\">\u00a0rs.<span id=\"d1uf134\" style=\"color: #000066\">close<\/span><span id=\"d1uf135\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf136\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"d1uf137\">\n<p id=\"d1uf138\">\u00a0<span id=\"d1uf139\" style=\"color: #009900\"><em id=\"i7ex35\">\/\/load the data into grid <br id=\"t-6v\" \/><\/em><\/span><\/p>\n<\/li>\n<li id=\"d1uf140\" style=\"color: black\">\n<p id=\"d1uf141\">\u00a0grid.<span id=\"d1uf142\" style=\"color: #006600\">clearAll<\/span><span id=\"d1uf143\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf144\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"d1uf145\" style=\"color: black\">\n<p id=\"d1uf146\">\u00a0grid.<span id=\"d1uf147\" style=\"color: #006600\">parse<\/span><span id=\"d1uf148\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf149\" style=\"color: #66cc66\">{<\/span>rows:data<span id=\"d1uf150\" style=\"color: #66cc66\">}<\/span>,<span id=\"d1uf151\" style=\"color: #3366cc\">&#8220;json&#8221;<\/span><span id=\"d1uf152\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"d1uf153\" style=\"color: black\">\n<p id=\"d1uf154\">\u00a0<span id=\"d1uf155\" style=\"color: #66cc66\">}<\/span> <span id=\"d1uf156\" style=\"color: #000066\"><strong id=\"i7ex36\">else<\/strong><\/span><\/p>\n<\/li>\n<li id=\"d1uf157\" style=\"color: black\">\n<p id=\"d1uf158\"><span id=\"d1uf159\" style=\"color: #009900\"><em id=\"i7ex37\">\/\/if there&#8217;s no Google Gears, load the data right from the server<\/em><\/span><\/p>\n<\/li>\n<li id=\"d1uf160\">\n<p id=\"d1uf161\">\u00a0grid.<span id=\"d1uf162\" style=\"color: #006600\">load<\/span><span id=\"d1uf163\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf164\" style=\"color: #3366cc\">&#8220;data.csv?uid=&#8221;<\/span>+grid.<span id=\"d1uf165\" style=\"color: #006600\">uid<\/span><span id=\"d1uf166\" style=\"color: #66cc66\">(<\/span><span id=\"d1uf167\" style=\"color: #66cc66\">)<\/span>,<span id=\"d1uf168\" style=\"color: #3366cc\">&#8220;csv&#8221;<\/span><span id=\"d1uf169\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"d1uf170\" style=\"color: black\">\n<p id=\"d1uf171\"><span id=\"d1uf172\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<li id=\"d1uf173\" style=\"color: black\">\n<p id=\"d1uf174\">&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p id=\"r0fs\"> Two examples described above allow us proxying the data through Google Gears. But there&#8217;s no other particular use of this, except for some traffic saving (when the second loading takes place, the data will be loaded from the local data store). Though if you load huge datasets, the saving can be substantial.<\/p>\n<p>There is one step left to make Gears really wholesome:<\/p>\n<p>Code (javascript)<br id=\"r0fs3\" \/><\/p>\n<ol id=\"r0fs4\">\n<li id=\"r0fs5\" style=\"color: black\">\n<p id=\"r0fs6\">&nbsp;<\/p>\n<\/li>\n<li id=\"r0fs7\" style=\"color: black\">\n<p id=\"r0fs8\">\u00a0grid.<span id=\"r0fs9\" style=\"color: #006600\">attachEvent<\/span><span id=\"r0fs10\" style=\"color: #66cc66\">(<\/span><span id=\"r0fs11\" style=\"color: #3366cc\">&#8220;onEditCell&#8221;<\/span>,<span id=\"r0fs12\" style=\"color: #003366\"><strong id=\"i7ex38\">function<\/strong><\/span><span id=\"r0fs13\" style=\"color: #66cc66\">(<\/span>stage,id,ind,value<span id=\"r0fs14\" style=\"color: #66cc66\">)<\/span><span id=\"r0fs15\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"r0fs16\" style=\"color: black\">\n<p id=\"r0fs17\">\u00a0<strong>\u00a0 <\/strong><span id=\"r0fs18\" style=\"color: #000066\"><strong id=\"i7ex39\">if<\/strong><\/span> <span id=\"r0fs19\" style=\"color: #66cc66\">(<\/span>stage==<span id=\"r0fs20\" style=\"color: #cc0000\">2<\/span><span id=\"r0fs21\" style=\"color: #66cc66\">)<\/span><span id=\"r0fs22\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"r0fs23\" style=\"color: black\">\n<p id=\"r0fs24\">\u00a0\u00a0\u00a0 grid.<span id=\"r0fs25\" style=\"color: #006600\">setRowTextStyle<\/span><span id=\"r0fs26\" style=\"color: #66cc66\">(<\/span>id,<span id=\"r0fs27\" style=\"color: #3366cc\">&#8220;font-weight:bold;&#8221;<\/span><span id=\"r0fs28\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"r0fs29\">\n<p id=\"r0fs30\"><em>\u00a0\u00a0\u00a0 <\/em><span id=\"r0fs31\" style=\"color: #009900\"><em id=\"i7ex40\">\/\/if there is Google Gears<\/em><\/span><\/p>\n<\/li>\n<li id=\"r0fs32\" style=\"color: black\">\n<p id=\"r0fs33\"><strong>\u00a0\u00a0\u00a0 <\/strong><span id=\"r0fs34\" style=\"color: #000066\"><strong id=\"i7ex41\">if<\/strong><\/span> <span id=\"r0fs35\" style=\"color: #66cc66\">(<\/span>db<span id=\"r0fs36\" style=\"color: #66cc66\">)<\/span> <span id=\"r0fs37\" style=\"color: #009900\"><em id=\"i7ex42\">\/\/save a new cell value in the local data store<\/em><\/span><\/p>\n<\/li>\n<li id=\"r0fs38\" style=\"color: black\">\n<p id=\"r0fs39\">\u00a0\u00a0\u00a0 db.<span id=\"r0fs40\" style=\"color: #006600\">execute<\/span><span id=\"r0fs41\" style=\"color: #66cc66\">(<\/span><span id=\"r0fs42\" style=\"color: #3366cc\">&#8220;update photodata set &#8220;<\/span>+columns<span id=\"r0fs43\" style=\"color: #66cc66\">[<\/span>ind<span id=\"r0fs44\" style=\"color: #66cc66\">]<\/span>+<span id=\"r0fs45\" style=\"color: #3366cc\">&#8220;=?, updated=1 where pkID=?&#8221;<\/span>,<span id=\"r0fs46\" style=\"color: #66cc66\">[<\/span>value,id<span id=\"r0fs47\" style=\"color: #66cc66\">]<\/span><span id=\"r0fs48\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"r0fs49\" style=\"color: black\">\n<p id=\"r0fs50\">\u00a0<span id=\"r0fs51\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<li id=\"r0fs52\" style=\"color: black\">\n<p id=\"r0fs53\"><strong>\u00a0<\/strong><span id=\"r0fs54\" style=\"color: #000066\"><strong id=\"i7ex43\">return<\/strong><\/span> <span id=\"r0fs55\" style=\"color: #003366\"><strong id=\"i7ex44\">true<\/strong><\/span>;<\/p>\n<\/li>\n<li id=\"r0fs56\">\n<p id=\"r0fs57\"><span id=\"r0fs58\" style=\"color: #66cc66\">}<\/span><span id=\"r0fs59\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"r0fs60\" style=\"color: black\">\n<p id=\"r0fs61\">&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p>The result is available here.<\/p>\n<p>If GoogleGears is not installed &#8211; everything continues to work as it was with the previous examples.<br \/>\nIf GoogleGears is installed, everything gets rather interesting: edit the cell and press F5. When the page is reloaded, new edited data will be presented in grid. You might just as well close the browser window and visit the same page using some other browser &#8211; edited data will still be there. Whatever the software and the network connection troubles are, there&#8217;s no way to lose your data!<\/p>\n<p><strong>Step Five &#8211; Slight Improvements<\/strong><\/p>\n<p>One thing left in order to finish up with the practice &#8211; to spruce up.<\/p>\n<p>Let&#8217;s start with adding a visual mark for edited lines. The field &#8220;Updated&#8221; has already been set in such a way that we need only to introduce slight changes into the data loading code to make changed data from the local data store look like newly edited one.<\/p>\n<p>Code (javascript)<br id=\"u.-:4\" \/><\/p>\n<ol id=\"u.-:5\">\n<li id=\"u.-:6\" style=\"color: black\"> <br id=\"u.-:7\" \/><\/li>\n<li id=\"u.-:8\" style=\"color: black\">\n<p id=\"u.-:9\"><em>\u00a0<\/em><span id=\"u.-:10\" style=\"color: #009900\"><em id=\"i7ex45\">\/\/style is used to mark already edited lines<\/em><\/span><\/p>\n<\/li>\n<li id=\"u.-:11\" style=\"color: black\">\n<p id=\"u.-:12\">\u00a0data.<span id=\"u.-:13\" style=\"color: #006600\">push<\/span><span id=\"u.-:14\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:15\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"u.-:16\" style=\"color: black\">\n<p id=\"u.-:17\">\u00a0 id:rs.<span id=\"u.-:18\" style=\"color: #006600\">field<\/span><span id=\"u.-:19\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:20\" style=\"color: #cc0000\">0<\/span><span id=\"u.-:21\" style=\"color: #66cc66\">)<\/span>,<\/p>\n<\/li>\n<li id=\"u.-:22\">\n<p id=\"u.-:23\">\u00a0\u00a0 style:rs.<span id=\"u.-:24\" style=\"color: #006600\">field<\/span><span id=\"u.-:25\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:26\" style=\"color: #cc0000\">16<\/span><span id=\"u.-:27\" style=\"color: #66cc66\">)<\/span>?<span id=\"u.-:28\" style=\"color: #3366cc\">\u2018font-weight:bold;\u2019<\/span>:<span id=\"u.-:29\" style=\"color: #3366cc\">\u201d<\/span>,<\/p>\n<\/li>\n<li id=\"u.-:30\" style=\"color: black\">\n<p id=\"u.-:31\">\u00a0\u00a0 data:<span id=\"u.-:32\" style=\"color: #66cc66\">[<\/span>rs.<span id=\"u.-:33\" style=\"color: #006600\">field<\/span><span id=\"u.-:34\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:35\" style=\"color: #cc0000\">1<\/span><span id=\"u.-:36\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:37\" style=\"color: #006600\">field<\/span><span id=\"u.-:38\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:39\" style=\"color: #cc0000\">2<\/span><span id=\"u.-:40\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:41\" style=\"color: #006600\">field<\/span><span id=\"u.-:42\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:43\" style=\"color: #cc0000\">3<\/span><span id=\"u.-:44\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:45\" style=\"color: #006600\">field<\/span><span id=\"u.-:46\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:47\" style=\"color: #cc0000\">4<\/span><span id=\"u.-:48\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:49\" style=\"color: #006600\">field<\/span><span id=\"u.-:50\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:51\" style=\"color: #cc0000\">5<br \/>\n<\/span><span id=\"u.-:52\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:53\" style=\"color: #006600\">field<\/span><span id=\"u.-:54\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:55\" style=\"color: #cc0000\">6<\/span><span id=\"u.-:56\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:57\" style=\"color: #006600\">field<\/span><span id=\"u.-:58\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:59\" style=\"color: #cc0000\">7<\/span><span id=\"u.-:60\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:61\" style=\"color: #006600\">field<\/span><span id=\"u.-:62\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:63\" style=\"color: #cc0000\">8<\/span><span id=\"u.-:64\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:65\" style=\"color: #006600\">field<\/span><span id=\"u.-:66\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:67\" style=\"color: #cc0000\">9<\/span><span id=\"u.-:68\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:69\" style=\"color: #006600\">field<\/span><span id=\"u.-:70\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:71\" style=\"color: #cc0000\">10<br \/>\n<\/span><span id=\"u.-:72\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:73\" style=\"color: #006600\">field<\/span><span id=\"u.-:74\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:75\" style=\"color: #cc0000\">11<\/span><span id=\"u.-:76\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:77\" style=\"color: #006600\">field<\/span><span id=\"u.-:78\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:79\" style=\"color: #cc0000\">12<\/span><span id=\"u.-:80\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:81\" style=\"color: #006600\">field<\/span><span id=\"u.-:82\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:83\" style=\"color: #cc0000\">13<\/span><span id=\"u.-:84\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:85\" style=\"color: #006600\">field<\/span><span id=\"u.-:86\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:87\" style=\"color: #cc0000\">14<\/span><span id=\"u.-:88\" style=\"color: #66cc66\">)<\/span>,rs.<span id=\"u.-:89\" style=\"color: #006600\">field<\/span><span id=\"u.-:90\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:91\" style=\"color: #cc0000\">15<\/span><span id=\"u.-:92\" style=\"color: #66cc66\">)<\/span><span id=\"u.-:93\" style=\"color: #66cc66\">]<\/span><span id=\"u.-:94\" style=\"color: #66cc66\">}<\/span><span id=\"u.-:95\" style=\"color: #66cc66\">)<\/span><\/li>\n<li id=\"u.-:96\" style=\"color: black\">\n<p id=\"u.-:97\">&nbsp;<\/p>\n<\/li>\n<\/ol>\n<blockquote><p>This point turned out to be quite time consuming in spite of all its simplicity. As it turned out, the basic version of grid can&#8217;t load styles from json data. This was healed with the help of a patch found at the support forum. But the whole affair left a bitter taste in my mouth.<\/p><\/blockquote>\n<p>When the grid is saved in the database, it would be a good thing to clear the data store.<\/p>\n<p id=\"u.-:102\">Code (javascript)<\/p>\n<ol id=\"u.-:103\">\n<li id=\"u.-:104\" style=\"color: black\">\n<p id=\"u.-:105\">&nbsp;<\/p>\n<\/li>\n<li id=\"u.-:106\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:107\"><span id=\"u.-:108\" style=\"color: #003366\"><strong id=\"i7ex46\">function<\/strong><\/span> save_data<span id=\"u.-:109\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:110\" style=\"color: #66cc66\">)<\/span><span id=\"u.-:111\" style=\"color: #66cc66\">{<\/span><\/p>\n<\/li>\n<li id=\"u.-:112\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:113\"><em>\u00a0<\/em><span id=\"u.-:114\" style=\"color: #009900\"><em id=\"i7ex47\">\/\/if there is Google Gears<\/em><\/span><\/p>\n<\/li>\n<li id=\"u.-:115\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:116\"><strong>\u00a0 <\/strong><span id=\"u.-:117\" style=\"color: #000066\"><strong id=\"i7ex48\">if<\/strong><\/span> <span id=\"u.-:118\" style=\"color: #66cc66\">(<\/span>db<span id=\"u.-:119\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li style=\"font-family: Verdana\" id=\"u.-:120\">\n<p id=\"u.-:121\"><em>\u00a0\u00a0 <\/em><span id=\"u.-:122\" style=\"color: #009900\"><em id=\"i7ex49\">\/\/clear the table we used &#8211; a disputable method, but in this case it&#8217;s effective<\/em><\/span><\/p>\n<\/li>\n<li id=\"u.-:123\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:124\">\u00a0\u00a0 db.<span id=\"u.-:125\" style=\"color: #006600\">execute<\/span><span id=\"u.-:126\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:127\" style=\"color: #3366cc\">\u2018drop table photodata\u2019<\/span><span id=\"u.-:128\" style=\"color: #66cc66\">)<\/span><\/p>\n<\/li>\n<li id=\"u.-:129\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:130\">\u00a0 document.<span id=\"u.-:131\" style=\"color: #006600\">forms<\/span><span id=\"u.-:132\" style=\"color: #66cc66\">[<\/span><span id=\"u.-:133\" style=\"color: #cc0000\">0<\/span><span id=\"u.-:134\" style=\"color: #66cc66\">]<\/span>.<span id=\"u.-:135\" style=\"color: #006600\">data<\/span>.<span id=\"u.-:136\" style=\"color: #006600\">value<\/span>=grid.<span id=\"u.-:137\" style=\"color: #006600\">serializeToCSV<\/span><span id=\"u.-:138\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:139\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"u.-:140\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:141\">\u00a0 document.<span id=\"u.-:142\" style=\"color: #006600\">forms<\/span><span id=\"u.-:143\" style=\"color: #66cc66\">[<\/span><span id=\"u.-:144\" style=\"color: #cc0000\">0<\/span><span id=\"u.-:145\" style=\"color: #66cc66\">]<\/span>.<span id=\"u.-:146\" style=\"color: #006600\">submit<\/span><span id=\"u.-:147\" style=\"color: #66cc66\">(<\/span><span id=\"u.-:148\" style=\"color: #66cc66\">)<\/span>;<\/p>\n<\/li>\n<li id=\"u.-:149\" style=\"color: black; font-family: Verdana\">\n<p id=\"u.-:150\"><span id=\"u.-:151\" style=\"color: #66cc66\">}<\/span><\/p>\n<\/li>\n<\/ol>\n<p>You can see the result here.<\/p>\n<p>Edited lines still remain visually different when the page is reloaded, thus it&#8217;s easy to notice the changes.<br \/>\nFull page reloading and data store clearing take place while the page is being saved.<br \/>\nEverything works from the technical point of view. As the last step we can add some free useful things such as sorting and filtering. Both the possibilities are standard for grid and don&#8217;t require any voodoo programming.<\/p>\n<p>Code (javascript)<br id=\"urfo5\" \/><br id=\"pafx\" \/><\/p>\n<ol id=\"c108\">\n<li id=\"c1080\" style=\"color: black\">\n<p id=\"c1081\">&nbsp;<\/p>\n<\/li>\n<li id=\"c1082\" style=\"color: black\">\n<p id=\"c1083\">grid.<span id=\"c1084\" style=\"color: #006600\">setColSorting<\/span><span id=\"c1085\" style=\"color: #66cc66\">(<\/span><span id=\"c1086\" style=\"color: #3366cc\">&#8220;str,str,str,int,int,int,str,str,int,int,int,int,int,<br \/>\nstr,na&#8221;<\/span><span id=\"c1087\" style=\"color: #66cc66\">)<\/span>;<\/li>\n<li id=\"c1088\" style=\"color: black\">\n<p id=\"c1089\">grid.<span id=\"c10810\" style=\"color: #006600\">attachHeader<\/span><span id=\"c10811\" style=\"color: #66cc66\">(<\/span><span id=\"c10812\" style=\"color: #3366cc\">&#8220;#rspan,#select_filter,#select_filter,#rspan,<br \/>\n#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,<br \/>\n#rspan,#rspan,#rspan&#8221;<\/span><span id=\"c10813\" style=\"color: #66cc66\">)<\/span>;<\/li>\n<li id=\"c10814\" style=\"color: black\">\n<p id=\"c10815\">&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p>The final result is available here.<\/p>\n<p><strong>The Step Not Present, or What Can Be Improved<\/strong><\/p>\n<p>The client side code works pretty well. Of course, we could make local data store origination more universal, add input data validation based on the current grid structure, etc. But it can be left as it is so far.<\/p>\n<p>The server code is terribly simple. Choosing a single-piece CSV as the type of data transfer and saving may result in the ultimate simplification of operations, but the price for that is loss of flexibility. In theory it is possible to replace the current saving scheme with something more elegant, allowing to use simultaneous access to data and smarter synchronization (since Gears was meant to be used in such scripts). But this will result in loss of code simplicity. So, maybe next time.<\/p>\n<p>The usage of local data store significantly improved usability with a relatively small amount of code needed. Taking into account the fact that most browsers are advertised as powered with local data stores, such a solution might be implemented without any outside plugin in the offing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Translated from original posted on www.monoxrom.net I&#8217;ve been trying to have a look at Google Gears in action, but always had some other fish to fry. You can hardly &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72,1],"tags":[33,6,14],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-general","category-uncategorized","tag-all-posts","tag-dhtmlxgrid","tag-tips"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/50","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=50"}],"version-history":[{"count":5,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":10852,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/50\/revisions\/10852"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}