Welcome, Guest
Please Login or Register.    Lost Password?

Search Form Question
(1 viewing) (1) Guest
Welcome to the ToolsJX forum!


Go to bottom
Post Reply
Post New Topic
Page: 1
TOPIC: Search Form Question
#342
Search Form Question 1 Year, 11 Months ago Karma: 0
Would it be possible for me to add the search field and button into a side module on my site and when it is clicked, go to the page that displays the table and displays the search results?

This is urgent so if you can help that'd be great.

Thanks
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
KawasakiMike9
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#343
Re:Search Form Question 1 Year, 11 Months ago Karma: 1
Hi,

you will have to change the code, no easy solution is possible.

My guess would be to pass parameters through URL and parse them before grid is displayed.

In GridBuilder.php (frontend), from line 188, variable $this->searchQuery

would be appropriate to change to parsed parameters from url (SQL code)

Best regards,
Viljem
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
viljem
Admin
Posts: 181
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#344
Re:Search Form Question 1 Year, 11 Months ago Karma: 0
Alright well I think I have it halfway figured out.

I set up a basic html form which sends it the variable to the next page with the search form on it. It enters the search term into the search box above the table but it doesn't run the query. I have to hit search again. Is there any way to run the AJAX with the query in the GET variable as the page loads.

I'd be willing to donate some money to TableJX if you could help me sort out this issue.

- Mike
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
KawasakiMike9
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Reply Quote
 
#345
Re:Search Form Question 1 Year, 11 Months ago Karma: 1
Hi,

1. I would create another variable e.g. otherModuleParam in GridBuilder.php
2. Get parameters from URL and set otherModuleParam variable
3. In GridView.php which extends GridBuilder.php I would check if this variable is set (not null) and call ajax script on load
(now we have on click)

similar to:
$field['output_script'] .=
" ><span class=\"field\">&nbsp;<b><a href=\"javascript:;\" onclick=\"SimpleAJAXCall('$grid_url&o_b=$conf_columns[$i]&o_d=$field[order_direction]&p=$this->page&s_f=$this->searchField&data_search=$this->searchStr&rpp=$this->rpp&ajax=1',SimpleAJAXCallback, '', 'data_listings$this->_ID');\" class=\"field\">";

from line 143 in GridView.php

But I didn't test this solution. You have to know here a little bit about javascript.

Best regards,
Viljem
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
viljem
Admin
Posts: 181
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2010/03/06 05:06 By viljem.
Reply Quote
 
#348
Re:Search Form Question 1 Year, 11 Months ago Karma: 5
Is there any way to run the AJAX with the query in the GET variable as the page loads.

Yes, you just have to specify two GET variables

Code:

?data_search=mysearchstring&s_f=0


where data_search contains your search string and s_f specifies your search field. If you want to search throuhg all fields you set it to 0 as shown in the example above.
Enter code here   
Please note: although no board code and smiley buttons are shown, they are still usable.
tomaz
Moderator
Posts: 282
graph
User Offline Click here to see the profile of this user
Last Edit: 2010/03/07 06:57 By tomaz.
Reply Quote
 
Go to top
Post Reply
Post New Topic
Page: 1
Moderators: tomaz
Tools JX, Powered by Joomla!; Joomla templates by SG web hosting