Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






jqGrid Filter module rewrite
Read original blog post

UserPost

13:47
15/02/2011


admin

Admin

posts 60

Hello all,
After many requests and of course the problems which causes current search module we have made a decision to rewrite them.
This actually is not standard task, because all existing features should be saved.
I can not guarantee that 100% of the existing features will be available, but we will do our best to save them
Three more important thing are the goal of this rewrite:

  1. We do not more will use jQuery clone function to create new row (the most important) , but after every change the filter will be recreated using the functions from common grid module
  2. Again with the available standard search like by example:
    …WHERE a=1 AND b=2
    now we can do more complex where clauses like this
    … WHERE ( (a=1 AND b=2) or c=3)
    This mean more than one group operator can be used.

  3. Implementing a checking modules for the data input in the filter

We have placed the code in GitHub.
https://github.com/tonytomov/jqGrid/commit/0002a389ffbeab00e536c02ecade03c72ba2a6e6

Any comments, recommendations, fixes are welcome during the development of this plugin.
Note that it can be used separately.

Kind Regards
Tony


Read original blog post

13:04
16/02/2011


OlegK

Germany

Member

posts 1210

It is very good new, Tony!

To help you to improve the new code I used JSlint and found following small errors or suggestions:

line 67 ended with ',' before ']' in the next line. One should remove the ','

in line 145,154,296,462,493,519,523,527,531,534 one should replace ',' with ';' at the end of line.

in line 309 will be defined unused variables o and df.

In line 516 the code '+ ""' (at the end of line) should be removed

in lines 82,119,164,184,354,377 one should add ';' at the end of lines

in line 219,354,433,468,490,492,511-514,516,517,545,547,557,559,568,570,626 insert {}

in lines 32,166,183,197,218,232,255,282,327,338,344,370,395,410,415,449,489,498,505,511-514,516,544,556,567,576 replace "==" to "==="
in lines 249,269,287,466,477,481,541,553 replace "!=" to "!=="

if would be better to move this.getStringForGroup from the line 464 after the line 494 where
the function this.getStringForRule will be defined because in lines 472,482
the function this.getStringForRule will be used inside of this.getStringForGroup

In the same way the function getStringForRule defined in the line 572 will be better to move before the line 538
where the function getStringForGroup defined which use it

I used the code loaded today so I hope the line numbers stay unchanged in your code.

I next days I want to look the new module more carefully and to test it.

Best regards
Oleg

16:40
16/02/2011


tony

Sofia, Bulgaria

Moderator

posts 7383

Thank you Oleg.

The most of corrections are implemented.

Will do the rest later.

Now we are on the final lap for the alfa.

Other modules will be changed at once.

I love the new module (I have a little problems with the local searching, but have already solution)

Thanks again

Tony

For professional UI suites for PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site – trirand.net – by the very same guys that created jqGrid.

14:02
18/02/2011


tony

Sofia, Bulgaria

Moderator

posts 7383

Hello,

If someone is interested on the new search filter a simple demo can be downloaded from this link

SearchDemo


Kind Regards

Tony

For professional UI suites for PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site – trirand.net – by the very same guys that created jqGrid.

05:39
23/02/2011


myearwood

Canada

New Member

posts 1

H Tony

Very good so far!

I haven't looked at the resulting where clause, but I hope you know to parameterize the user values and not concatenate them into a query string. That leads to SQL Injection and no amount of escaping the user-entered values is foolproof.

In the demo, I think there should be and/or drop down after each condition. I'd like to see the filter represented in a grid with a vertical scrollbar as well as the results grid with a vertical scrollbar.


Mike

19:56
25/02/2011


OlegK

Germany

Member

posts 1210

Hi Tony!

Just one idea. It would be nice to implement some kind of "filter collection": the list of some predefined filters with the name and description which could be easy loaded or saved (first in the internal parameter of jqGrid, next in qookie and which can be easy exported).

Having the possibility to define a complex query in a nice feature (what one has in the new filter module), but it could be too complex for standard users. The usage of predefined "filter collection" could simplify the work and improve users satisfaction. One could allow to switch from "standard mode" of choosing only predefined queries to "advanced mode" where full posibilities of the new filter module could be used.

Best regards
Oleg 


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

215


Currently Online:

38 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 10274

Posts: 30361

Membership:

There are 11038 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1210

markw65 – 179

kobruleht – 144

phicarre – 132

YamilBracho – 124

Renso – 118

Administrators: admin (60 Posts)

Moderators: tony (7383 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information