When treeGrid: true is set then search is not working…
I have following code to enable search option
$(‘#treegrid’).jqGrid(‘filterToolbar’, { stringResult:false, searchOnEnter: true });
Â
I am using latest version.
Whats the other alternative to perform search on treegrid?Â
Hello,
Searching in tree is a not standard task. It require to find all parent and descendant nodes of the searched item.
You can make your own searching procedure start from here
Its basically a filter not a search
Its no need complex tree search on this… treegrids are made of 1 table… and not mutiple tables as you can see… so search must be work fine… Don’t know why they dont work :S
Anyone found a solution or workaround?
Hello,
As of the new version 4.8 we support serching in TreeGrid.
We have prepared a example which demonstrates this feature.
Please look at this TreeGrid Search example
Kind Regards,
Hi there all,
I have recently upgraded my php jqsuite from 4.6 to 4.8.2 in order to have searching work in my treegrid.
I use this snippet of code for searching (not using the built in toolbar):
1 2 3 4 5 6 7 8 9 10 11 |
var searchValue = $("#searchField").val(); var filter = {"groupOp": "OR", "rules": [{"field": "naam", "op": "cn", "data": searchValue}, {"field": "omschrijving", "op": "cn", "data": searchValue}]}; $('#tree').setGridParam({ postData: { filters: JSON.stringify(filter) }, search: true }); $('#tree').trigger("reloadGrid"); |
The searching itself works, however after the search is complete I lose all my custom formatters that I had defined in PHP.
In 4.6 this way of searching only worked for top level elements, but the custom formatters actually did show up after the search was complete.
How do I use the search AND keep my custom formatters in 4.8.2?
Hello,
Sorry that we have missed this post.
The way you use this currently is not supported – this means that the server side searching in tree is not supported.
In order this to work you maybe need to load all the data and set load once to true. This way the grid will be in local data and the serch will be possible.
Kind Regards,
Will
Guriddo Support Team
Example in link doesn’t working … I entered “black” in ‘color’ column but nothing happened..I am expecting it will show only the rows with ‘color’ column as ‘black’
Hello,
When searching in tree we return the the full tree node which contain black.
This is standard in tree searching.
See another such components to see it in action
Kind Regards,
Will
Guriddo Support Team
Hello,
When searching in tree we return the the full tree node which contain black.
This is standard in tree searching.See another such components to see it in action
Kind Regards,
Will
What is the expected result when using the example?
Like the other posters I don’t think the example is working
I either see the full tree with no indication of which rows include the matched lines, or I see a totally empty grid if I enter a term that doesn’t exist.
After searching for ‘black’ I would expect to see the rows that include black, their parents (and possibly children) but extraneous nodes should be hidden
eg when filtering for black I expect to see
1 2 3 4 5 6 |
ELECTRONICS 0.00 0 TELEVISIONS 0.00 0 TUBE 0.00 0 26 " TV 200.00 1 black 30 " TV 350.00 2 black |
I do not expect to see
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
LCD 0.00 0 Super-LCD 42" 400.00 10 all PLASMA 0.00 0 Ultra-Plasma 62" 440.00 2 silver Value Plasma 38" 312.00 0 silver PORTABLE ELECTRONICS 0.00 0 MP3 PLAYERS 0.00 0 FLASH 0.00 0 Super-Shuffle 1gb 20.00 11 all 5Gb Flash 0.00 0 10Gb flash 0.00 0 Power-MP3 128mb 123.00 2 withe CD PLAYERS 0.00 0 Porta CD 10.00 0 CD To go! 110.00 11 2 WAY RADIOS 0.00 0 Family Talk 360 200.00 15 |
since they are not parent or children o
MymsMan
Hello,
Maybe one possible solution is to configure the deep of the search node results. We will see what we can do for this purpose.
Kind Regards
Will
Guriddo Support Team
Thanks for considering this.
Your current approach might work adequately for grids with a large number of root, level 0, nodes and relatively few leaf nodes for each root.
However I am trying to show the files structure of a video recorder and I only have a single root node, multiple sub directory nodes and potentially hundreds of leaf nodes (recordings).
With your current filter approach every search would return either the entire tree or nothing while I need something closer to Windows file search showing the path to just the matching items.
As an interim step between current processing and my desired result could you consider not expanding the nodes that don’t have ‘black’ in any of their offspring. This would give a more compact result.
1 2 3 4 5 6 7 8 9 |
ELECTRONICS 0.00 0 TELEVISIONS 0.00 0 TUBE 0.00 0 26 " TV 200.00 1 black 30 " TV 350.00 2 black LCD 0.00 0 PLASMA 0.00 0 PORTABLE ELECTRONICS 0.00 0 |
MymsMan
Hello,
We have implemented your suggestion and we find it very useful.
The updated code is in GitHub. It is in beta and needs to be refined.
If you want you can get it and test it.
Any other recommendation is welcome.
Best Regards,
Thank you for implementing this however I am having some problems getting it to work which may be due to my unfamiliarity with installing code from GitHub!
.
I downloaded the zip file from github and copied js/jquery.jqGrid.min.js and js/grid.treegrid.js to my server and included them in my web page. Is that correct/ sufficient?
.
When I attempted to search I noticed that rather than the local search which I was expecting (since treegrid switches to local after loading) it sent a search request to the server
1 2 3 4 |
_search true filters {"groupOp":"AND","rules":[{"field":"autodecrypt","op":"eq","data":"1"}]} |
.
It appears to be because I had loadonce: false which is needed for incremental tree load, when I switched to loadonce:true local search started to work but of course I lost the benefits of incremental loading.
.
Is it possible to have my cake and eat it? I would like to have both incremental load and local search but with the limitation that search can only find data in the nodes that have already been loaded.
.
Whilst the new code seems to work well most of the time it does fail on some occasions and I have yet to spot any pattern in the failures. I have a number of columns that contain 0 or 1, filtering for 1 nearly always works whilst filtering for 0 sometimes works but other times it either returns no results or all rows.
I will continue to look for a reproducible test case,
.
I also noticed a problem sorting a tree grid After it has been filtered
1 2 3 |
TypeError: a is undefined ...if("function"==typeof b)return b(a);if(c=a<strong class="d4pbbc-bold"></strong>,void 0===c)try{if("string"==typeof... |
Sorting before filtering is OK and Sorting a non-tree grid is OK when filtered
MymsMan
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top