Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pepys on Apr 21, 2009 07:14
open dhtmlx forum
:: pepysDHTMLX :: Set auto value for #combo_filter

You can see here all my code. I'm trying to use a auto value for a combo filter, but is not working. Why? Can you help me please?

Also, how can I set a default value for a text_filter?

Where can I find more details in dhtmlx documentation abuot this?


I'm waiting for your answer, thanks.

Regards,
Samuel


<head>

<link rel="STYLESHEET" type="text/css" href="http://samuel/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">

<link rel="STYLESHEET" type="text/css" href="http://samuel/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_pgn_bricks.css">

<link rel="STYLESHEET" type="text/css" href="http://samuel/dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.css">

<link rel="STYLESHEET" type="text/css" href="http://samuel/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.css">


<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_sub_row.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_combo.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_link.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_pgn.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_group.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxGrid/codebase/ext/dhtmlxgrid_mcol.js"></script>


<script src="http://samuel/dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxTreeGrid/codebase/dhtmlxtreegrid.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxTreeGrid/codebase/ext/dhtmlxtreegrid_filter.js"></script>


<script src="http://samuel/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>

<script src="http://samuel/dhtmlx/dhtmlxCalendar/codebase/dhtmlxcommon.js"></script>




</head>


<script>


    mygrid = new dhtmlXGridObject('gridbox');
    mygrid.imgURL = "http://dhtmlx/dhtmlxGrid/codebase/imgs/";

    mygrid.enableLightMouseNavigation(true);

        
//    mygrid.enablePaging(true,22,10,"pagingArea",true,"infoArea");
//    mygrid.setPagingSkin("bricks");
    mygrid.enableSmartRendering(true);


//    mygrid.groupBy(4);    
    //    mygrid.setHeader("");
//    mygrid.attachHeader(",#text_filter,#numeric_filter,,#text_filter,");
    
    
    mygrid.setSkin("light");
    mygrid.init();

    mygrid.loadXML("mygrid.php?tname=useri_adrese&m=28", xLoadXML);
    function xLoadXML(){
//        var dispColIndex = mygrid.getColIndexById('actiuni');
//        alert(dispColIndex);
        }



//    mygrid.enableSmartXMLParsing(true);

//    mygrid.addRow(rowId,rowValuesAr,rowIndex,parentId,icon);
    
            
    mygrid.attachEvent("onXLE",function(){

    
        mygrid.getFilterElement(0).setComboValue("Kokolino Bombilici");

        
        });    
    
    //    mygrid.attachEvent("onFilterEnd",mygrid.refreshFilters);
//    

//    mygrid.getFilterElement(3).value=">100";
//    mygrid.filterByAll();
    
    myDataProcessor = new dataProcessor("update.php?tname=useri_adrese&m=28");
    
    myDataProcessor.setTransactionMode("POST");

    myDataProcessor.enableDataNames(true);
    myDataProcessor.setUpdateMode("cell");
    myDataProcessor.enableDebug(true);
    myDataProcessor.init(mygrid);
    myDataProcessor.setOnAfterUpdate(function(){
        alert("OnAfterUpdate");     

        });




</script>




<rows>

<head>

<beforeInit>

<call command="attachHeader">

<param>
#combo_filter,#text_filter,#combo_filter,#combo_filter,<input type='submit' onClick='xRefreshFilters()' value='Reset filtre'>
</param>
</call>
</beforeInit>
<column type="ro" width="250" sort="str" id="nume">User (nume si prenume)</column>
<column type="ro" width="350" sort="int" id="ord">Adresa</column>
<column type="ro" width="150" sort="int" id="ord">Judet</column>
<column type="ro" width="150" sort="int" id="ord">Localitate</column>
<column type="ro" width="*" align="left" id="actiuni">Actiuni & Links</column>
</head>

<row id="1">
<cell>Samee Doiooi</cell>

<cell>
Str. Stefan cel Mare, bl. 172, sc. B, et. 2, ap. 89
</cell>
<cell>Targul Mures</cell>
<cell>Iasi</cell>

<cell>
<a href="edit_tabel.php?tname=useri_adrese&m=28&id=1" >edit</a> • <a href="edit_tabel.php?tname=useri_adrese&m=28&sterge=1&id=1" onClick="if (confirm('Confirmati stergerea?')) return true; else return false;">delete</a>
</cell>
</row>

<row id="7">
<cell>Kokolino Bombilici</cell>
<cell>Str.Pacii, nr. 34</cell>
<cell>Vaslui</cell>
<cell>Iasi</cell>

<cell>
<a href="edit_tabel.php?tname=useri_adrese&m=28&id=7" >edit</a> • <a href="edit_tabel.php?tname=useri_adrese&m=28&sterge=1&id=7" onClick="if (confirm('Confirmati stergerea?')) return true; else return false;">delete</a>
</cell>
</row>
Answer posted by dhxSupport on Apr 21, 2009 07:25
To set auto value to the #combo_filter you can use:
mygrid.getFilterElement(0).setComboValue(mygrid.cellByIndex(0,0).getValue());
To set default value to the #text_filter you can use:
mygrid.getFilterElement(1).value=mygrid.cellByIndex(0,1).getValue();
Answer posted by pepys on Apr 21, 2009 07:56
As you can see, I used already the syntax

mygrid.getFilterElement(0).setComboValue("Kokolino Bombilici");

Can you see that in the first post... ???!!!!!!

and IT'S NOT WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

WE HAVE A REGISTERED VERSION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

PLEASE, GIVE ME THE PROPER HELP, NOT JUST COPY/PASTE from documentation..

Where I have to put the syntax

mygrid.getFilterElement(0).setComboValue(mygrid.cellByIndex(0,0).getValue());

After or before mygrid.init()????? In what function ..????!!

What I have to include in <head>..</head> ????



Answer posted by dhxSupport on Apr 21, 2009 08:03

>>mygrid.getFilterElement(0).setComboValue("Kokolino Bombilici"); 

This syntax works well. You shoudl call getFilterElement method after all rows was loaded:

mygrid.attachEvent("onXLE",function(){
  mygrid.getFilterElement(0).setComboValue("Kokolino Bombilici");
  mygrid.getFilterElement(1).value="Str.Pacii";
  });
Working sample will be send you by email

Answer posted by pepys on Apr 21, 2009 08:01

mygrid.attachEvent(“onXLE”,function(){

                grid.getFilterElement(index).setComboValue(value);

});


This one? It is not working, also. I have maybe to include something, or what... ?????

Answer posted by dhxSupport on Apr 21, 2009 08:07

There right syntax is:

mygrid.attachEvent(“onXLE”,function(){

  mygrid.getFilterElement(index).setComboValue(value);

});

>>It is not working, also

Please descripbe how doesn't it work. Does your browser return any errors? 

Answer posted by pepys on Apr 21, 2009 08:10
When I use that syntax, all my combo filters is without any options, without pre-defined values, they are blank.. and that's all
Answer posted by dhxSupport on Apr 21, 2009 08:21

Try to use following code:

mygrid.attachEvent("onXLE",function(){
  mygrid.getFilterElement(0).enableFilteringMode(false);
  mygrid.getFilterElement(0).setComboValue("Kokolino Bombilici");
 });


Attachments (1)
Answer posted by pepys on Apr 22, 2009 01:14
The script which you've sended me is not working for me.. I just sended you an email on support@dhtmlx.com with some details about this, please answer me asap.. Thanks
Answer posted by dhxSupport on Apr 22, 2009 04:20
It seems you are using old version of dhtmlxgrid_filter.js file. You page returns error: 
mygrid.getFilterElement is not a function
.../test/combo_filter.html
Line 23

It means that getFilterElement method is not defined. 

New version of dhtmlxgrid_filter.js was send you by email

Answer posted by pepys on Apr 22, 2009 04:49
Hi again,

I overwrited the file dhtmlxgrid_filter.js and as you can see in the attached image, is just partly working now.. The auto values is there, but the filter is not working..

        mygrid.attachEvent("onXLE",function(){
           
            mygrid.getFilterElement(0).enableFilteringMode(false);

            mygrid.getFilterElement(0).setComboValue("Kokolino Bombilici");
            mygrid.getFilterElement(1).value = "stefan";           
            //mygrid.getFilterElement(1).value=mygrid.cellByIndex(0,1).getValue();
            //mygrid.filterByAll();
        });    


Any ideeas.. ??

Thanks..