javascript - Hiding igGrid rows -


Before I get out of my hair, I ask here what 'simple' thing is missing me is. I have a Infragistics igGrid where I have buttons for the user to hide some lines (filter) on the Infragistics forum I got this suggested code:

  hide the function () {$ ( "# IgGrid"). IgGrid ("allrows") Each (function (index) {var id = $ (this) .attr ("colName"); a line with id & lt; 4 will be hidden if (id & lt; 4) {$ (this) .css ("Display", 'none');}});  

Looks simple, but it does not work.

In Chrome debug, this is shown as 'a' tr (its an HTMLTableRowElement in IE) !! And there is a 'cell' attribute that is an HTMLCollection ==> What I really want! However, below I did not really try to get the value of a cell / column.

  var aa = $ (this) .attr ("colName"); // undefined var bb = $ (this); Displays in the form of // e.fn.e.init in DDbugger [1] ???? Var cc = bb.cells [3]; // Uncaught TypeError: can not read the '3' property of the undefined var dd = bb.getRowIndex (); // Uncaught TypeError: Undefined a function var is not a = $ (this). Cells; // undefined var b = $ (this). Seals [3]; // Uncaught TypeError: Undefined var C = $ (this) property '3' can not be read. GetRowIndex (); // Uncaught TypeError: Undefined a function var d = $ (this) .attributes.getNamedItem ("colName") is not; // Uncaught TypeError: The properties of undefined var can not read 'getNamedItem' e = $ (this) .attributes.colName; // Uncaught TypeError: can not read the properties of 'undefined var f = $ (this)' colName '. GetNamedItem ("colName"); // Uncaught TypeError: Undefined one function var g = $ (this) is not. GetAttribute ("colName"); // Uncaught TypeError: Undefined is not a function  

So what am I missing ??

Afterwards, find out, I'm having another problem. Obviously the condition to hide the rows above will not be a hardcode '4' In the external onclick function I set a variable that holds the condition value. However, in this igGrid function I see that my variable is out of the scope. How do I close my variable to the 'hide ()' function?

There is a difference between filtering and the hide filter will be removed from the cosine, hidden only the row invisible Will make. The easiest solution will be to apply a filter to the table. It can be easily linked to a button click handler, see JSFiddle link below.

Hidden

You can hide a row by setting it to the CSS display property 'None'; You can select all the rows using the following

  // Exclude Headers and Footer Rows, Select All Rows Var GridRoctor = 'Table.UI- iggrid-table.ui-Widget-Content & gt; Groups & gt; Tr '; // Hiding a line while clicking on it (gridRowSelector). Click (function () {$ (this) .hide ();}); // Show all hidden rows $ (gridarau selector) Show ();  

Filtering

You can filter the grid in two ways.

  1. Enable filtering on the grid, then use the dropdown in the column header to set your filter IgGrid ({features: [{name: "filtering", type: " Local ", Mode:" Advanced ", Filter Diagnosis:" Window "}]});

  2. Apply filter to manually grid View IGGrid filtering:

      $ ('# grid'). IgGridFiltering ("filter", ([[field name: "age", xp: "30", cond: "mostly", logic: "OR"}])); To remove all filters, apply empty filter to the grid:  
      // Remove all filters $ ('#grid'). IgGridFiltering ("Filter", "");  

    I have created a JSFDial with hidden / unheard and filtering / unfilurring.

    JSFiddle:


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -