{"action":"opened","issue":{"url":"https://api.github.com/repos/koalyptus/TableFilter/issues/58","labels_url":"https://api.github.com/repos/koalyptus/TableFilter/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/koalyptus/TableFilter/issues/58/comments","events_url":"https://api.github.com/repos/koalyptus/TableFilter/issues/58/events","html_url":"https://github.com/koalyptus/TableFilter/issues/58","id":116109611,"number":58,"title":"filtering when table is empty","user":{"login":"mmaction","id":15781463,"avatar_url":"https://avatars.githubusercontent.com/u/15781463?v=3","gravatar_id":"","url":"https://api.github.com/users/mmaction","html_url":"https://github.com/mmaction","followers_url":"https://api.github.com/users/mmaction/followers","following_url":"https://api.github.com/users/mmaction/following{/other_user}","gists_url":"https://api.github.com/users/mmaction/gists{/gist_id}","starred_url":"https://api.github.com/users/mmaction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmaction/subscriptions","organizations_url":"https://api.github.com/users/mmaction/orgs","repos_url":"https://api.github.com/users/mmaction/repos","events_url":"https://api.github.com/users/mmaction/events{/privacy}","received_events_url":"https://api.github.com/users/mmaction/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-10T13:48:45Z","updated_at":"2015-11-10T13:48:45Z","closed_at":null,"body":"i'm working on a table that uses filtering and sorting as well as multiselection with the advancedGrid extension.\r\neverything works fine so far but some points seem no to work as expected:\r\n1: If the table does not contain any data i get no on_after_filter event. in the status bar i see the message \"Re-setting filters values...\"\r\ni've used this event for avoiding ugly, transient page renderings i experienced when table contained lots of data\r\n2. Per default the webserver sends 12 \"empty\" table rows if table is empty (or 8 empty rows if only 4 entries present), so that the table looks always the same, including the alternating rows. if i use the rows_counter i get wrong a counter since the \"empty\" rows are counted as well. Whats the best workaround to deal with that?\r\n\r\n-> it would be great to have a feature for defining a fixed number of rows showing in the table including alternate rows etc. and not worrying about rows_counter, grid_height, selection events etc.\r\n\r\ni attached my htm file (removed irrelevant stuff):\r\n\r\nthanks michael\r\n\r\n____________________\r\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\r\n<head>\r\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\r\n<title>WE512696_U04</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n<meta http-equiv=\"expires\" content=\"0\" />\r\n<meta http-equiv=\"cache-control\" content=\"no-cache\" />\r\n<meta http-equiv=\"pragma\" content=\"no-cache\" />\r\n<link rel=\"stylesheet\" href=\"../global.css\" type=\"text/css\" />\r\n<script language=\"javascript\" src=\"../global.js\" type=\"text/javascript\"></script>\r\n</head>\r\n\r\n<body onload=\"if (typeof onPageLoad == 'function') {onPageLoad();}\">\r\n  <!-- header -->\r\n  <div id=\"divHeader\">\r\n    <!-- logo -->\r\n    <!--/body-->\r\n    <!-- status -->\r\n    <!-- logout -->\r\n  </div>\r\n  <div id=\"divAppl\">\r\n    <ul>\r\n      </ul>\r\n  </div>\r\n\r\n  <div id=\"divMenu\">\r\n    <table>\r\n      <tr>\r\n<td style=\"width: 4px;\">&nbsp;</td>\r\n<td style=\"width: 4px;\">&nbsp;</td>\r\n\t  </tr>\r\n    </table>\r\n  </div>\r\n  <div id=\"divContent\">\r\n    <!-- main content -->\r\n    <table id=\"tableContent\">\r\n      <tr>\r\n        <td style=\"vertical-align:top;\">\r\n          <table id=\"tableLeftNav\">\r\n            <tr><td class=\"leftNavTitle\"></td></tr>\r\n            <tr><td style=\"vertical-align:top;\">\r\n<!-- ===== left navigation ===== -->\r\n\r\n\r\n            </td></tr>\r\n          </table>\r\n        </td>\r\n        <td style=\"vertical-align:top; width:100%;\">\r\n          <!-- ===== form ===== -->\r\n          <form action=\"MyFile.cgi\" method=\"post\">\r\n          <table id=\"tableRightContent\">\r\n            <!-- ===== headline ===== -->\r\n            <tr><td class=\"headline\"></td></tr>\r\n            <tr><td>\r\n              <!-- ===== start of the actual dialog ===== -->\r\n              <table id=\"tableDialog\" >\r\n\r\n                <tr>\r\n                  <td class=\"boldLeft\" style=\"vertical-align:bottom;padding-bottom:10px;\">MyEntries</td>\r\n                </tr>\r\n                <tr>\r\n                  <td>\r\n                    \r\n                    <table class=\"tblData\" id=\"tblRemoteUnits\">\r\n\r\n                      <thead> \r\n                      \t<tr>\r\n                          <th class=\"bglightgray\">No.</th>\r\n                          <th class=\"bglightgray\">Unit&nbsp;ID</th>\r\n                          <th class=\"bglightgray\">Address</th>\r\n                          <th class=\"bglightgray\">Entry&nbsp;Type</th>\r\n                          <th class=\"bglightgray\">Connection</th>     \r\n                       \t  <th style=\"display:none;\"></th>\r\n                      \t  <th style=\"display:none;\"></th>   \r\n                      \t</tr>\r\n                      </thead>                                          \r\n                      <tbody>\r\n                      </tbody>\r\n\t\t\t\t\t          </table>\r\n                  </td>\r\n                </tr>\r\n               \r\n                <tr style=\"display:none;\">\r\n                  <td class=\"left\" > \r\n                    <input type=\"hidden\" id=\"hdnUnitId\" name=\"hdnUnitId\" value=\"\"/> \r\n                    <input type=\"hidden\" id=\"hdnRndUid\" name=\"hdnRndUid\" value=\"\"/> \r\n                    <input type=\"hidden\" id=\"hdnOrigin\" name=\"hdnOrigin\" value=\"\"/>\r\n                    <input type=\"hidden\" id=\"remoteUnit\" name=\"remoteUnit\" value=\"\"/>\r\n                    <input type=\"hidden\" id=\"hdnSelectedEntries\" name=\"hdnSelectedEntries\" value=\"\"/>\r\n                  </td>\r\n                </tr>                 \r\n\r\n                <tr><td style=\"height:15px;\">&nbsp;</td></tr>\r\n                <tr>\r\n                  <td class=\"center\"> \r\n                    <input name=\"btnAdd\" id=\"btnAdd\" type=\"submit\" accesskey=\"a\" title=\"Add (Alt + A)\" value=\"Add\"\r\n                         /> \r\n                    &nbsp;&nbsp;&nbsp;&nbsp; \r\n                    <input name=\"btnModify\" id=\"btnModify\" type=\"submit\" accesskey=\"m\" title=\"Modify (Alt + M)\" value=\"Modify\"\r\n                         /> \r\n                    &nbsp;&nbsp;&nbsp;&nbsp; \r\n                    <input name=\"btnDelete\" id=\"btnDelete\" type=\"submit\" accesskey=\"d\" title=\"Delete (Alt + D)\" value=\"Delete\" \r\n                         /> \r\n                    &nbsp;&nbsp;&nbsp;&nbsp; \r\n                    <input name=\"btnDeleteAll\" id=\"btnDeleteAll\" type=\"submit\" accesskey=\"l\" title=\"Delete All (Alt + L)\" value=\"Delete All\" \r\n                         /> \r\n                    &nbsp;&nbsp;&nbsp;&nbsp;                        \t\r\n                    <input name=\"btnUpdate\" id=\"btnUpdate\" type=\"submit\" accesskey=\"u\" title=\"Update (Alt + U)\" value=\"Update\" \r\n                         /> \r\n                    &nbsp;&nbsp;&nbsp;&nbsp;\r\n                    <input name=\"btnDetails\" id=\"btnDetails\" type=\"submit\" accesskey=\"t\" title=\"Details (Alt + T)\" value=\"Details\"\r\n                    \t />\r\n                  </td>\r\n                </tr>\r\n               \r\n               <tr><td style=\"height:25px;\">&nbsp;</td></tr>   \r\n                \r\n                <tr >\r\n                  <td class=\"center\"> \r\n                    <input name=\"btnStart\" id=\"btnStart\" type=\"submit\" style=\"width:150px\" accesskey=\"r\" title=\"Start (Alt + R)\" value=\"Start Remote Session\"\r\n                         /> \r\n                    &nbsp;&nbsp;&nbsp;&nbsp; \r\n                    <input name=\"btnStop\" id=\"btnStop\" type=\"submit\" style=\"width:150px\" accesskey=\"b\" title=\"Modify (Alt + B)\" value=\"Stop Remote Session\"\r\n                         /> \r\n                  </td>\r\n                </tr>\r\n                \r\n              </table> <!-- \"tableDialog\" -->\r\n              <!-- ===== end of the actual dialog ===== -->\r\n<!-- ====== JavaScript =============================== -->              \r\n \t  <script language=\"javascript\" src=\"../tablefilter/tablefilter.js\" type=\"text/javascript\"></script>     \r\n \t  <script type=\"text/javascript\">\r\n      //<![CDATA[\r\n      \r\n        var tf = null;                        \r\n      \r\n        // --------------------------------------\r\n        function showTable(o)\r\n        // --------------------------------------      \r\n      \t{\r\n      \t  document.getElementById(\"tableDialog\").style.visibility = \"visible\";      \r\n      \t}\r\n            \r\n        // --------------------------------------\r\n      \tfunction afterRowSelected(o, row)    \r\n        // --------------------------------------  \r\n      \t{                \r\n      \t  var selection = tf.extension('advancedGrid')._ezEditTable.Selection;\t      \t  \r\n          var activeRow = selection.GetActiveRow();\r\n          if (activeRow)\r\n          { \r\n\t      \tif (activeRow.cells[0].innerHTML == \"\")\r\n\t      \t{\r\n\t      \t  // empty row -> deselect it\r\n                  selection.DeselectRow(activeRow);\r\n      \t\t  updateButtons();\r\n\t      \t}\r\n     \t\t  else\r\n      \t\t{\r\n              document.getElementById(\"hdnSelectedEntries\").value = selection.GetSelectedValues();\t\r\n      \t\t\t\r\n              copyCellValue(activeRow, 2, \"remoteUnit\");\r\n              copyCellValue(activeRow, 1, \"hdnUnitId\");\r\n              copyCellValue(activeRow, 5, \"hdnRndUid\");\r\n              copyCellValue(activeRow, 6, \"hdnOrigin\");  \r\n          \t}        \r\n          }                \t  \t  \t     \r\n      \t}\r\n\t      \t      \r\n        /* Setup table filtering */\r\n      \ttf = new TableFilter('tblRemoteUnits', \r\n      \t{            \t\t\r\n      \t\t/* filters behaviour */\r\n      \t\tbase_path: '../tablefilter/',\r\n      \t\tcol_widths: [ \"50px\", \"145px\", \"340px\", \"90px\", \"155px\" ],      \r\n      \t\tcol_0: \"none\",\r\n      \t\tcol_3: \"select\",\r\n      \t\tfilters_row_index: 1,\t\r\n      \t\tauto_filter: true,\r\n      \t\tauto_filter_delay: 0,\r\n      \t\tremember_grid_values: true,\r\n      \t\talternate_rows: true,\r\n      \t\tmark_active_columns: true,\r\n      \t\twatermark: \"search...\",\r\n      \t\ton_after_filter: showTable,\r\n      \r\n      \t\t/* drop-down filter */\r\n      \t\tdisplay_all_text: \"All\",\t \r\n      \r\n      \t\t/* grid layout */\r\n      \t\tgrid_layout: true,\r\n      \t\tgrid_height: '228px',\t\r\n      \t\tgrid_width: '770px',\r\n      \r\n      \t\t/* status bar, rows counter, help instructions, reset button */\r\n      \t\tstatus_bar: true,\r\n      \t\trows_counter: true,\t\r\n      \t\trows_counter_text: 'Number of Remote Units: ',\t\r\n      \t\tbtn_reset: true,\r\n      \t\thelp_instructions: false,\r\n      \r\n      \t\t/* extensions */     \r\n    \t\textensions:\r\n      \t\t[\r\n            \t{\r\n            \t  name: 'sort',\r\n      \t\t\t    types: ['Number', 'String', 'ipaddress', 'String', 'String' ],\t \r\n        \t    },\r\n      \t\t\t{\r\n      \t\t\t  name: 'advancedGrid',\r\n       \t\t\t  vendor_path: '../ezEditTable/',\r\n\t      \t    selection_model: 'multiple',\t\r\n      \t\t\t  editable: true,\t\r\n\t      \t    editor_model: 'cell',\r\n      \t\t\t  on_after_selected_row: afterRowSelected,\t      \t\t\t\r\n      \t\t\t}\t\r\n          ],  \r\n      \r\n      \t});      \r\n      \ttf.init();\t    \r\n            \t                   \t\t\r\n      //]]>\r\n      </script>\r\n<!-- ====== end JavaScript =========================== -->              \r\n            </td></tr>\r\n          </table>\r\n        </form>\r\n      </td>\r\n    </tr>\r\n    </table> <!-- \"tableContent\" -->\r\n  </div>\r\n</body>\r\n</html>\r\n\r\n"}}