<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: the one million dollar question please about formatting Truly dynamic tables.</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>deepakpol on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19983</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19983</guid>
        	        	<description><![CDATA[<blockquote>
<p>OlegK said:</p>
<p>It seems to me that it is a new question. Nevertheless&#8230;</p>
<p>Nothing is impossible. But some things are a little tricky. What do you asked for can be realized outside of jqGrid (as external filters) very easy. The realisation of the same scenario inside of jqGrid is do possible but a little tricky. One can define use <strong>dataEvents</strong> property of <a href="/jqgridwiki/doku.php?id=wiki:common_rules#editoptions" target="_blank">editoptions</a> and define <strong>&#39;change&#39;</strong> custom event handle. In the handle you can make an ajax request to the server (I recommend you include caching of this ajax request, because information about coutries will be changed not so friquently) and then rebuild &#60;select&#62; element of the secton column.</p>
<p><a id="editoptions" name="editoptions" target="_blank"></a>You can searach the forum for the corresponding examples. For example <a href="/blog/?page_id=393/help/dynamically-populate-select-dropdown/" target="_blank">here</a> you will find discussion and examples on the subject.</p>
<p>Best regards<br />Oleg</p>
</blockquote>
<hr />
<p>Hi Oleg,</p>
<p>Much thanks for the reply. I am new to this forum (and also to jqGrid) and not being able to search for help topics I need efficiently. This topic was similar to what I needed and asked the question here.</p>
<p>Really appreciate your help.</p>
<p>Thanks,</p>
<p>-Deepak</p>
]]></description>
        	        	<pubDate>Fri, 24 Sep 2010 12:53:09 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19958</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19958</guid>
        	        	<description><![CDATA[<p>It seems to me that it is a new question. Nevertheless&#8230;</p>
<p>Nothing is impossible. But some things are a little tricky. What do you asked for can be realized outside of jqGrid (as external filters) very easy. The realisation of the same scenario inside of jqGrid is do possible but a little tricky. One can define use <strong>dataEvents</strong> property of <a href="/jqgridwiki/doku.php?id=wiki:common_rules#editoptions" target="_blank">editoptions</a> and define <strong>&#39;change&#39;</strong> custom event handle. In the handle you can make an ajax request to the server (I recommend you include caching of this ajax request, because information about coutries will be changed not so friquently) and then rebuild &#60;select&#62; element of the secton column.</p>
<p><a id="editoptions" name="editoptions" target="_blank"></a>You can searach the forum for the corresponding examples. For example <a href="/blog/?page_id=393/help/dynamically-populate-select-dropdown/" target="_blank">here</a> you will find discussion and examples on the subject.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Thu, 23 Sep 2010 15:51:15 +0300</pubDate>
        </item>
        <item>
        	<title>deepakpol on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19957</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19957</guid>
        	        	<description><![CDATA[<hr />
<p>Is it possible to filter other select inputs in the same row based on value from select input selected during inline edit without reloading the grid?&#160;</p>
<p>Eg. If I have two columns in a table country and state, I select the row so that it becomes editable (using event based editing); when I select country, it automatically filters states based on the selection or even vice versa if I select a state then it filters the country.</p>
<p>It could be assumed that country and state dropdowns are pre-populated with values.</p>
<p>Thanks,</p>
<p>-Deepak</p>
]]></description>
        	        	<pubDate>Thu, 23 Sep 2010 15:33:27 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19954</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19954</guid>
        	        	<description><![CDATA[<p>Hello Vivaldi!</p>
<p>1) If you use mtype: &#39;GET&#39; the values from postData will be just concatinated to the value of url parameter of jqGrid. To be exactly the values will be encoded with respect of encodeURIComponent function. Before concatianting postData value to url will be verified whether url already contain &#39;?&#39; in not yet then the &#39;?&#39; will be inserten between url and converted postData. If &#39;?&#39; alreasdy exist, then &#39;&#38;&#39; will be used like between on different properties of postData. For example if url:&#39;/myDataProvider&#39; and postData: {city:"New York",regionId:2} then the destination url will be &#39;/myDataProvider?city=New+York&#38;regionId=2&#39;. So it is very easy in use.</p>
<p>Morover if postData: {city:function() { return $("#country option:selected").val(); },regionId:2} then on every reload of data will be get the current selected value from the drop-down list with id="contry" (# selector mean &#39;id&#39; and not &#39;name&#39; attribute): &#39;&#60;select id="country"&#62;...&#60;/select&#62;&#39;</p>
<p>2) you should better never use event handle like "onchange" direct in HTML code: &#39;&#60;select id="country" onchange="myReload(this.value)"&#62;&#39;; It is <strong>every old</strong> style, it has many disadvantages. For example myReload() funtion must be global which is bad because of different reasons.&#160; Yo can use $("#country").change(/*..your function.*/) which is simplified form of $("#country").bind(&#39;change&#39;, /*..your function.*/). You can declare a local function myReload() which you can place inside of can inside of jQuery(document).ready event handler</p>
<p>var myReload = function () {...};</p>
<p>but all this only the question of style and performance, but another way will be also work.</p>
<p>3) It is not important how much rows has you database. The server should get back only 10 rows in every responce back (you have rowNum:10). The value will be send to the server as a part of every request. If the user select another value from the rowList:[10,20,30] array, that the server should get back the correspondind maximal number of rows. You can use SELECT TOP (10) on the backend or other will known construction. Examine how paging of data could be better implemented in your database. The server should produce output in the one of the form described in <a href="/jqgridwiki/doku.php?id=wiki:retrieving_data" target="_blank">"Data Manipulation"</a> chapter of registry. If you want a liitle speed up your solution you can produce and transfer data in <a href="http://www.json.org/" target="_blank">JSON format</a> instead of XML.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Thu, 23 Sep 2010 12:44:01 +0300</pubDate>
        </item>
        <item>
        	<title>vivaldi on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19934</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19934</guid>
        	        	<description><![CDATA[<p>Hello, Oleg</p>
</p>
<p>I have followed the pieces of code here and there and tried to put it all together to the top of my head, I think I am somewhat close, yet, there are lines of code uncompleted</p>
</p>
<p>STARTING TO DEFINE THE CLIENT SIDE</p>
<p>jQuery(&#39;#grid_selector&#39;).jqGrid({</p>
<p>&#160;&#160; &#160;url:&#39;example.php&#39;,<br />&#160;&#160; &#160;postData: //THIS WOULD BE THE FILTERING PARAMETERS</p>
<p>&#160;&#160; &#160;{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; CountryId: function() { return jQuery("#CountryId option:selected").val(); },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; RegionId: function() { return jQuery("#RegionId option:selected").val(); },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; CityId: function() { return jQuery("#CityId").val(); }<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;datatype: &#39;xml&#39;, // STANDARD JSON INFO<br />&#160;&#160; &#160;mtype: &#39;GET&#39;,<br />&#160;&#160; &#160;colNames:[&#39;HotelName&#39;,&#39;Description&#39;, &#39;Address&#39;,&#39;Price&#39;,&#39;Total&#39;,&#39;Notes&#39;],<br />&#160;&#160; &#160;colModel :[<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;Hname&#39;, index:&#39;invid&#39;, width:55},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;descript&#39;, index:&#39;invdate&#39;, width:90},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;address&#39;, index:&#39;amount&#39;, width:80, align:&#39;right&#39;},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;price&#39;, index:&#39;tax&#39;, width:80, align:&#39;right&#39;},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;total&#39;, index:&#39;total&#39;, width:80,align:&#39;right&#39;},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;note&#39;,index:&#39;note&#39;, width:150, sortable:false} ],<br />&#160;&#160; &#160;pager: jQuery(&#39;#pager&#39;),<br />&#160;&#160; &#160;rowNum:10,<br />&#160;&#160; &#160;rowList:[10,20,30],<br />&#160;&#160; &#160;sortname: &#39;id&#39;,<br />&#160;&#160; &#160;sortorder: &#39;desc&#39;,<br />&#160;&#160; &#160;viewrecords: true,<br />&#160;&#160; &#160;imgpath: &#39;themes/basic/images&#39;,<br />&#160;&#160; &#160;caption: &#39;My first grid&#39;</p>
<p>});</p>
<p>If you have your own interface for searching/filtering..Yes I do, selectboxes</p>
<p>you should just append your url yourself ...Yes, but how, where ?</p>
<p>and reload the grid with respect of trigger(&#39;reloadGrid&#39;)</p>
<p>like this then...<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;var myReload = function() <br />&#160;&#160; &#160;{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myGrid.trigger(&#39;reloadGrid&#39;);<br />&#160;&#160; &#160;};</p>
<p>On the HMTL block (same page as above):</p>
<p>Now, if user change selected option in select box with id=CountryId or another select box with id=CityId (with mouse or keyboard), the function myReload will be called</p>
<p>echo &#39;&#60;select name="country" onchange="myReload(this.value)"&#62;&#39;;</p>
</p>
<p>...yet, there must be something missing...</p>
</p>
<p>lets see the logic. The select boxes have an onChange event. When something "shakes" in the select box, the onChange event sends that parameter (this) to myReload function (which would probably be just an ajax piece of code). Then this myReload forwards that parameter to a php script which will build the table. ..</p>
<p>Also, what about the XML file the plugin needs to build the table ? I&#160; have hundreds of rows ...</p>
</p>
<p>thank you very much</p></p>
]]></description>
        	        	<pubDate>Wed, 22 Sep 2010 17:06:20 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19925</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19925</guid>
        	        	<description><![CDATA[<p>Hi!</p>
<p>Now I understand you problem. It can be very easy implemented with respect of jqGrid. Look at my <a href="http://stackoverflow.com/questions/2928371/how-to-filter-the-jqgrid-data-not-using-the-built-in-search-filter-box/2928819#2928819" target="_blank">old answer</a> on the stackoverflow.com.</p>
<p>You should define &#39;change&#39; event handler on the select html element with contries and call <strong>trigger(&#39;reloadGrid&#39;)</strong> on your jqGrid to refresh the data on any select of net contry. Moreover, you can send in all requests to the server the curent value selected in the &#39;country&#39; select element. To do this you can use <strong>postData</strong> with functions as the value of some properties. I recommend you also insert in all select lists like &#39;country&#39; the option with the text &#39;All&#39; and the empty value. This option could be default. This will allows to get unfiltered data.</p>
<p>You can also use <a href="/jqgridwiki/doku.php?id=wiki:toolbar_searching" target="_blank">filterToolbar</a> to implement the same bevavior inside of jqGrid. I prefere to use stringResult:true option additionally to stay compatible with the <a href="/jqgridwiki/doku.php?id=wiki:advanced_searching#options" target="_blank">advanced searching</a>.</p>
<p>How you can see jqGrid is very flexible and allow you impelment different scenarios.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Wed, 22 Sep 2010 13:45:58 +0300</pubDate>
        </item>
        <item>
        	<title>vivaldi on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19924</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19924</guid>
        	        	<description><![CDATA[<blockquote>
<p>Hello Oleg</p>
</blockquote>
<blockquote>
</blockquote>
<blockquote>
<p>The scenario I describe is everywhere, so maybe I did not explain myself correctly. I give you a real life example. Think of a web for hotels. You see 3 select list. Countries, Provinces and Cities, of course, each select list has many of everything, any countries, many provinces within that country and many cities within that province.</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Country Germany, Staat Bayern, City Munich.&#160; All of them are interdependent, Bayern will contain Stuttgart, M&#252;nchen etc.</p>
<blockquote>
<p>Below those select lists, you have&#160; a table displaying hotels. Once you select Munich, you may get 46 hotels, divided in 5 pages, (4 of 10 and the last has 6 hotels). You may click next next and at a moment, you decide to change city and you choose Stuttgart (You are still in Bayern) and now you get 34 hotels, which would be of course, 4 pages, (3 x 10) + 1 x 4 .&#160; Well, the pagination updates itself and now. But you dont need to press buttons or change pages. The select lists OnChange event passes new values to the SQL query of the table and the table which is passed those parameters via Ajax calls, renders different shows of <strong>pages</strong> every time you choose new country or new province or new city.</p>
</blockquote>
<blockquote>
<p>This is what I meant. Yes, it is true, the web administrator, or a hotel owner may at any time add one hotel more, but until the insertion has not been completed, the end user sees nothing different. After the insertion has been completed, when the user does another search of the same place, obviously, he will see one new row.</p>
</blockquote>
<blockquote>
<p>If you dont see it clearly, I can send you a videoshot of how those menus work, but I think it is clear now.</p>
</blockquote>
<blockquote>
<p>spasiva zsaranie</p>
</blockquote>
<blockquote>
</blockquote>
<blockquote>
</blockquote>
<blockquote>
</blockquote>
<blockquote>
</blockquote>
<blockquote>
</blockquote>
<blockquote>
<p>OlegK said:</p>
</blockquote>
<blockquote>
<p>Hello Vivaldi,</p>
<p>In my opinion you do can use jqGrid to implement dynamic table. But loading of current data from the server on every row select or cell select I find not good. The developer of jqGrid found this also not good and not implemented this kind of "dynamic tables" in the jqGrid. The reason is easy to explain. If you do so, and a some row before selected row is inserted then the selected row must be one row below after the data refresh. This behavior will make the user&#160;crazy. He selected a row and the row run away. So I see no sense in reloading of data on every row/cell select.</p>
<p>If the data (a cell or a row) will be modified, then the&#160;modified&#160;data will be send to the server and if you implemented on the server a&#160;concurrency&#160;check (I prefer optimistic&#160;concurrency), then an error will be displayed if the same data row was modified by another user. But modifying of data is another question.</p>
<p>What jqGrid do is asking <strong>the page of data</strong> from the server per ajax. If you use datatype:&#39;xml&#39; then the server should send to the client the page in xml format. If you use jqGrid with the datatype:&#39;json&#39;, than the data must be send in JSON format. In every request the server received always 1) the name of the column by which the data should be sorted and the sorting direction 2) the page number requested 3) the current number of rows per page. So if the user click on a column for the data sorting or click on the next/previous page and so on the request to refresh the data will be send to the server. The server can ask the Database Server per SELECT statement or more&#160;sophisticated&#160;STORED PROCEDURE to get only one requested page of <strong>actual</strong> information. So the user will be see really <strong>current</strong> information.</p>
<p>In the last project which I implemented using jqGrid I cached the data additionally with ETags. So if the client has already the data for the page requested the client send ETag from the page which it has in the cache (ETag is a part of HTTP header which are saved in the local cache of every browser together with the data). If the server see that the current data in the database are not changed and the calculated ETag is the same as the client has, then <strong>the server send back no data</strong> and "Not Modified" HTTP code instead of usual 200 (OK). The client get the data from the local cache and for the user all stay exactly as all would be without data caching.&#160;Nevertheless&#160;one can be sure also in the scenario that what the user see after the page refresh, after the click on the next page or change of sorting are really <strong>actual</strong>&#160;data.</p>
<p>So I can repeat: in my opinion jqGrid allows you implement really dynamic tables.</p>
<p>Best regards<br />Oleg&#160;</p>
</blockquote>
<hr />
]]></description>
        	        	<pubDate>Wed, 22 Sep 2010 12:39:27 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19915</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19915</guid>
        	        	<description><![CDATA[<p>Hello Vivaldi,</p>
<p>In my opinion you do can use jqGrid to implement dynamic table. But loading of current data from the server on every row select or cell select I find not good. The developer of jqGrid found this also not good and not implemented this kind of "dynamic tables" in the jqGrid. The reason is easy to explain. If you do so, and a some row before selected row is inserted then the selected row must be one row below after the data refresh. This behavior will make the user&#160;crazy. He selected a row and the row run away. So I see no sense in reloading of data on every row/cell select.</p>
<p>If the data (a cell or a row) will be modified, then the&#160;modified&#160;data will be send to the server and if you implemented on the server a&#160;concurrency&#160;check (I prefer optimistic&#160;concurrency), then an error will be displayed if the same data row was modified by another user. But modifying of data is another question.</p>
<p>What jqGrid do is asking <strong>the page of data</strong> from the server per ajax. If you use datatype:&#39;xml&#39; then the server should send to the client the page in xml format. If you use jqGrid with the datatype:&#39;json&#39;, than the data must be send in JSON format. In every request the server received always 1) the name of the column by which the data should be sorted and the sorting direction 2) the page number requested 3) the current number of rows per page. So if the user click on a column for the data sorting or click on the next/previous page and so on the request to refresh the data will be send to the server. The server can ask the Database Server per SELECT statement or more&#160;sophisticated&#160;STORED PROCEDURE to get only one requested page of <strong>actual</strong> information. So the user will be see really <strong>current</strong> information.</p>
<p>In the last project which I implemented using jqGrid I cached the data additionally with ETags. So if the client has already the data for the page requested the client send ETag from the page which it has in the cache (ETag is a part of HTTP header which are saved in the local cache of every browser together with the data). If the server see that the current data in the database are not changed and the calculated ETag is the same as the client has, then <strong>the server send back no data</strong> and "Not Modified" HTTP code instead of usual 200 (OK). The client get the data from the local cache and for the user all stay exactly as all would be without data caching.&#160;Nevertheless&#160;one can be sure also in the scenario that what the user see after the page refresh, after the click on the next page or change of sorting are really <strong>actual</strong>&#160;data.</p>
<p>So I can repeat: in my opinion jqGrid allows you implement really dynamic tables.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Wed, 22 Sep 2010 02:13:12 +0300</pubDate>
        </item>
        <item>
        	<title>vivaldi on the one million dollar question please about formatting Truly dynamic tables.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19913</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/the-one-million-dollar-question-please-about-formatting-truly-dynamic-tables#p19913</guid>
        	        	<description><![CDATA[<p>Hello, Zdrastvuite,</p>
</p>
<p>Please, just one question. I have read the 127 pages manual. Still I dont have the answer to this simple question.</p>
</p>
<p>I am seeing that all table formatters plugins, say they format also from server, ajax etc, and they call that Dynamic data. However, as I read they actually ask you to indicate a table from the database upon which to make the plugin work. A table or an XML data, but that makes no difference, it is still static.</p>
</p>
<p>I want to know if Jquery Grid can be used in this scenario:</p>
<p>Really dynamic loading of data. For example, you have select boxes, and as you interact with them, a table which is receiving their parameters alters itself. Here, here is where I want to have them paginated in real time. The table that is actually shown as you interact with the select boxes will probably be the result of a SQL query to several tables, that is the simple but true dynamism I want. In the 127 pages by Mr.Tonkov, they give an example but they ask you to manually populate an XML datafile. Obviously, that would not be feasible with more than 20 rows. let alone some thousands.</p>
<p>So far, all I see is, like I said, a static table of the DB.</p>
</p>
<p>Thanks a lot</p>
<p>Emelianenko fan</p>
]]></description>
        	        	<pubDate>Wed, 22 Sep 2010 01:18:21 +0300</pubDate>
        </item>
</channel>
</rss>