Categories | Question details Back To List | ||
mygrid.attachHeader("#combo_filter") Showing empty records and erroring Hi DHTMLX Group, I have an issue, I'm loading a grid and the grid is populating correctly. Now I wanted to add a combo_filter to my grid so that a dropdown of all the results can be shown. My table is large obviously. In my example I have 3 fields which I want to all Auto-filter so the user can limit the selections. I don't want auto suggest on either if possible, just a simple select from the dropdown only. I couldn't understand doing this in the attachHeader way. I have the dropdowns on the page appearing correctly but if I click on the dropdown arrow only an empty row is shown. If I start to type in the dropdown box the dropdown arrow is disabled on one keystroke and when I click on the arrow I'm getting an error in my browsers left hand corner which is saying "_locator is a null or not an object" - line 682. Here is my script so far. My SQL is almost 100% identical to your example, just using another table and different field names to get it working the way I want. var mygrid; var mygridQString = "getgridrecords.php"; function doInitGrid(){ mygrid = new dhtmlXGridObject('mygrid_container'); mygrid.setImagePath("dhtmlxGrid/dhtmlxGrid/codebase/imgs/"); mygrid.setHeader("Country,Short Code,Continent"); mygrid.attachHeader("#combo_filter,#combo_filter,#combo_filter"); mygrid.setColSorting("server,server,server"); mygrid.setInitWidths("*,150,250"); mygrid.setColTypes("ro,ro,ro"); mygrid.setColAlign("left,left,left"); mygrid.setSkin("light"); mygrid.init(); mygrid.enableSmartRendering(true); mygrid.loadXML(mygridQString); } Any Ideas? Your assistance is appreciated. Luke Answer posted by dhxSupport on Apr 30, 2009 01:30 It seems you are using dynamic smart rendering mode. Native grid's filters cannot work correctly with rows which wasn't loaded to the client side yet. But we have extention dhtmlxConnectors which can allow you implement server-side sorting and filtering. Please see more information here http://www.dhtmlx.com/docs/products/dhtmlxConnector/index.shtml http://www.dhtmlx.com/docs/products/dhtmlxConnector/doc/guide.html#cc_guide Answer posted by Luke Hepburn on Apr 30, 2009 05:20 Thank you for this, this works fine now. My initial problem was with ID's now that you mention it in some way. So basically if my limit is made to suit then it will be sort of fine. I may keep it this way until I notice a need for me to change. I've tested the other way but I'm not to sure I like the way the dropdown works on "beforefilter". Because I need to load all the values in there I'm worried I'll be loading to much. I also prefer each drop down to be reduced based on the filters applied. I can't see how this works with the connector method. Answer posted by Luke Hepburn on Apr 30, 2009 05:42 Oh one more thing - is there a way to pass a default value to the select_filter by any chance? I want to have certain filters already defined based on my profile in the application prior to the page loading. (Defaulting Country for example) Answer posted on May 01, 2009 14:34 >>is there a way to pass a default value to the select_filter You can't do it at filter init, but you can use next API to set value of select , after data loading, and apply filtering mygrid.load(ulr,function(){ mygrid.getFilterElement(INDEX).value="default value" mygrid.filterByAll(); }) where INDEX - index of necessary column Answer posted by Support on May 01, 2009 14:39 >>I'm not to sure I like the way the dropdown works on "beforefilter". Because I need to load all the values in there Existing implementation of "select" filters in current version of connectors is bit ugly - it will be improved in oncoming update ( 1.0 version ) >> to be reduced based on the filters applied. I can't see how this works with the connector method. It not possible with current version of connectors ( and so far it not planed to be included in next version as well ) >>I'm worried I'll be loading to much. The usage of server side filtering and connectors has sense if you loading a lot of data ( thousands of rows ) , in such case reloading a tens of rows for each filtering will be a much lesser stress for both client and server than loading of full dataset at once. If you have medium or small set of data, usage of client side filtering looks more logical. |