Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mathijs Gaalman on Jun 30, 2008 14:16
open dhtmlx forum
Grid filter and cookie

Hi,

Is it possible to save the filter that is set in the header of a grid in a cookie or load it using a specific variable?

Thanks,
MG
Answer posted by Support on Jul 01, 2008 01:35
Grid has-not any built-in functionality for such purpose.
Answer posted by ragsna on Aug 10, 2008 07:18
Hi there,
I just wanna come back to the original poster topic.
I finally got it working of storing the value of the filter into a cookie and reload it during startup. But I'm still facing a problem:
Is there a way of "setting" the value of the builtin "filterBy()" function of a selectbox (by ID or value)?
I mean, when I get the stored value of the last filter from the cookie and perform a filterBy(), the columns are filtered, but the "selectbox" is empty.


Thanks in advance.
ragsna

Answer posted by Support on Aug 11, 2008 02:11
After XML loading the selectbox filled with values from related column. 
There is no direct reference to SELECT element, so it can be reached only through DOM

      var select=grid.hdr.rows[rowIndex].cells[columnIndex].getElementsByTagName("SELECT")[0];
      select.value = "necessary one"

where rowIndex - index of row in header (1 based), cellIndex - index of column in header (0 based)

Answer posted by ragsna on Aug 11, 2008 09:31
Hmm,
it looks like it is not working how it should. If I use:

var select=.mygrid.hdr.rows[2].cells[6].getElementsByTagName("SELECT")[0];
select.value = "123"

nothing happens in the selectbox.
It should show the 123 in the selectbox of column 6 and row 2.
Do I have to change the "SELECT" element, too?

And the other way around. Is it also possible in this way to readout the selected value of a selectbox by using DOM in this manner? If yes, how?

Thanks again.




Answer posted by Support on Aug 12, 2008 03:40
>>Do I have to change the "SELECT" element, too?
#select_filter - SELECT
#text_filter - INPUT

>>Is it also possible in this way to readout the selected value of a selectbox by using DOM in this manner? If yes, how?
The "var select" calculated in the way described above is a select HTML object, so you can use its  current value as select.value

Please check sample ( sent by email )
Answer posted by ragsna on Aug 12, 2008 06:38
Unfortunately nothing arrived yet here.
Would you please be so kind to send it again (######@googlemail.com)?
Many thanks in advance!
--
ragsna

Answer posted by Support on Aug 12, 2008 06:38
Email resent to provided email.