Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
Partner
Partner

Search function in a table

Hello, I develop a qlik sense extension (a table) and i want to know how I can put a the search function like the original table (see picture)
Thank.

Labels (2)
1 Solution

Accepted Solutions
Partner
Partner

Re: Search function in a table

Ok, I have a solution.

The support said me : Unfortunately, we do not have an example or documentation to share for what you are trying to develop.

So I can't have the exact same search function, but I have developpe an other one:

I put an unique ID on my table, and a input type text before the table:

 

var uniqueID = getUniqueID();
var input = <input class="inputText_7" type="text" placeholder="Search...">, html = <table id="'+uniqueID+'" >;

The uniqueID was initialised by this function :

 

 

function getUniqueID(){
  var uniqueID = new Date();
  return uniqueID.getTime();
}

Then I just create my table, I print it, and I create a event:

 

 

$element.html( input+html );
$element.find('.inputText_7').on('keyup', function() {
  var filter = this.value.toUpperCase();
  searching(hypercube.qDataPages[0].qMatrix, filter, uniqueID);
});

And the more important function:

 

 

	function searching (rows, inp, uniqueID) {
		var tr, td, i, tmp, table;
  		table = document.getElementById(uniqueID);
		tr = table.getElementsByTagName("tr");
  		for (i = 0; i < tr.length; i++) {
    		   td = tr[i].getElementsByTagName("td")[0];
    		   if (td) {
      			if (td.innerHTML.toUpperCase().indexOf(inp) > -1)
       		 		tr[i].style.display = "";
      			else tr[i].style.display = "none";
    		   }
  		}
	}

 

 

3 Replies

Re: Search function in a table

You developed Qliksense Extension? There must be one more script to create search icon as well - That you have to find out? You may help which is that extension?
Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Partner
Partner

Re: Search function in a table

Hello, yes i think too they is a script or a API for use the search function in qlik sense, but i didn't find it. I didn't find other table extension who use this search function... This is why I ask to the Qlik community.

Partner
Partner

Re: Search function in a table

Ok, I have a solution.

The support said me : Unfortunately, we do not have an example or documentation to share for what you are trying to develop.

So I can't have the exact same search function, but I have developpe an other one:

I put an unique ID on my table, and a input type text before the table:

 

var uniqueID = getUniqueID();
var input = <input class="inputText_7" type="text" placeholder="Search...">, html = <table id="'+uniqueID+'" >;

The uniqueID was initialised by this function :

 

 

function getUniqueID(){
  var uniqueID = new Date();
  return uniqueID.getTime();
}

Then I just create my table, I print it, and I create a event:

 

 

$element.html( input+html );
$element.find('.inputText_7').on('keyup', function() {
  var filter = this.value.toUpperCase();
  searching(hypercube.qDataPages[0].qMatrix, filter, uniqueID);
});

And the more important function:

 

 

	function searching (rows, inp, uniqueID) {
		var tr, td, i, tmp, table;
  		table = document.getElementById(uniqueID);
		tr = table.getElementsByTagName("tr");
  		for (i = 0; i < tr.length; i++) {
    		   td = tr[i].getElementsByTagName("td")[0];
    		   if (td) {
      			if (td.innerHTML.toUpperCase().indexOf(inp) > -1)
       		 		tr[i].style.display = "";
      			else tr[i].style.display = "none";
    		   }
  		}
	}