https://antibiotiqueaugmentin.com/surdosage-augmentin-bebe/
× Welcome to the ToolsJX forum!


Search Form Question

  • KawasakiMike9
  • KawasakiMike9's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
14 years 8 months ago #342

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

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #343

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

Please Log in or Create an account to join the conversation.

  • KawasakiMike9
  • KawasakiMike9's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
14 years 8 months ago #344

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

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #345

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 .=
" ><span class=\"field\"> <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

Last edit: 14 years 8 months ago by user62.

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #348


Yes, you just have to specify two GET variables

?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.

Last edit: 14 years 8 months ago by tomaz.

Please Log in or Create an account to join the conversation.

Moderators: tomaz
Time to create page: 0.141 seconds

Contact Us

Contact us on Discord

Contact us on Facebook