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


Display Data After Submit, but ....

  • proyectoc77
  • proyectoc77's Avatar Topic Author
  • Visitor
  • Visitor
12 years 5 months ago #1871

Hi. I've tried this option and works ok, when I put for example an id number 987654-5, it's show me the result, but.. if y press the search button and the shearch box is blank it's show me all the data!!!. Obviosly I only want to show the data asociated to the id. How can I configure this?. I've tried the options but I can't do it. thanks.

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

More
12 years 5 months ago #1874

Hi,

You may filter the data according to the Joomla user id by using additional where condition with the parameter @user_id. In this case all the users would have to be registered on your Joomla site.

Another thing you can do is a little bit of hacking. If you are familiar with coding you can say: do not call for data if the search box is empty.

In the file components/js/grid.js in the function searchjx() add the following line before SimpleAJAXCall on the end of the function.

if(ds=="")return;

It would get a little bit more complicated if you are using advanced filters.

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

  • proyectoc77
  • proyectoc77's Avatar Topic Author
  • Visitor
  • Visitor
12 years 5 months ago #1875

Hi. The option that you say me, all the user have to be registered, is not posible, I don't have the registered option activated, only public visitors.

So, I have a little know of code, and I tried the way you show me inserting the code "if(ds=="")return;" but don't work, still show me all the data.

The grid.js in my site is in /components/com_grid/js/grid.js not in components/js/grid.js as you said before.

grid.js the code was (only the last lines)
______________________________________________________

//url+="&ajax=1&tmpl=component";
url+="&ajax=1"
//alert(sf+' '+ds+' '+grid_url+' '+id);


SimpleAJAXCall(url,SimpleAJAXCallback, '', 'data_listings'+id);
}
______________________________________________________


now with the code you give me
______________________________________________________

//url+="&ajax=1&tmpl=component";
url+="&ajax=1"
//alert(sf+' '+ds+' '+grid_url+' '+id);

if(ds=="")return;

SimpleAJAXCall(url,SimpleAJAXCallback, '', 'data_listings'+id);
}
______________________________________________________

but don't work. I'm doing something wrong??, thanks.
any ideas?
Thanks. I apreciated your help.

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

More
12 years 5 months ago #1876

You are right about the file and about the code. This is exactly what I meant. Are you using the advanced filter option? If you are a bit different hack should be used.

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

  • proyectoc77
  • proyectoc77's Avatar Topic Author
  • Visitor
  • Visitor
12 years 5 months ago #1877

Yes, I'm using the advanced filter option, and advanced search option, I forced to "exact" search, deleting the lines 577 and 579 in GridBuilder.php, with this I only have the exact search option in frontend, so if the user enter an invalid number don't show anything, works ok, but if the search box is empty and does the search It's show me all the entries! , I'm confused how to proced,


\n<option value="default" '; if($this->advSearchOption == "default")$search_form .='selected'; $search_form .='>'.JText::_('JX_DEFAULT_SEARCH').'</option>
\n<option value="exact" '; if($this->advSearchOption == "exact")$search_form .='selected'; $search_form .='>'.JText::_('JX_EXACT_SEARCH').'</option>
\n<option value="begins" '; if($this->advSearchOption == "begins")$search_form .='selected'; $search_form .='>'.JText::_('JX_BEGINS_WITH').'</option>


to this , "exact" search only

\n<option value="exact" '; if($this->advSearchOption == "exact")$search_form .='selected'; $search_form .='>'.JText::_('JX_EXACT_SEARCH').'</option>


I'm little closer but still I need this feature, another ideas why don't work with the code you give me?...
I'm still trying

thanks a lot.

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

More
12 years 5 months ago #1878

If you are using Advanced Filter option the variable "ds" is built by the following rule.

ds=column_name1|search_data1|column_name2|search_data2

and so on.

So instead of just checking if(ds==""), you have to check if the search data for your column is empty string ("") than return. You can see a few lines above how the ds variable is built in the case of Advanced Filters. You could do the check there too.

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

Moderators: tomaz
Time to create page: 0.134 seconds

Contact Us

Contact us on Discord

Contact us on Facebook