Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Add Custom serch Button
(1 viewing) (1) Guest
Go to bottomPage: 1234
TOPIC: Add Custom serch Button
#52011
Re:Add Custom serch Button 9 Years, 8 Months ago Karma: 0
Hello. I finally was able to make the table work in such way that a search is done only when the Enter key is pressed (not every keypress as currently). I spent various days to figure it out and finally achieved it (Thank God primarily!). I read various threads in forums; I tried fnSetFilteringDelay plugin for Datatables (datatables.net) too - to delay call to search while typing - without being able to make it work (maybe some people have done it successfully); anyway, this thread was very very useful for me: stackoverflow.com/questions/14619498/datatables-global-search-on-keypress-of-enter-key-instead-of-any-key-keypress/.

Basically, what I did was to modify the file told before by Admin: <joomla_directory>\modules\mod_aridatatables\includes\kernel\DataTables\Models\class.DataTablesWidgetDatatableModel.php in the following way:

Code:

function initClientInstance($id, $params, $hiddenColumns, $mParams, $columnsSettings)
{
$cfg = $mParams['_default'];
$useJQueryUI = (bool)$params['bJQueryUI'];
if ($useJQueryUI)
AriDataTablesHelper::includeJQueryUITheme($cfg['jQueryUITheme']);

$loadMethod = AriUtils::getParam($params, 'loadMethod', 'ready');

$jsOptions = $this->getJsOptions($id, $params, $hiddenColumns, $mParams, $columnsSettings);

$fixedColCode = $this->getFixedColCode(AriUtils::getParam($params, 'fixedcols', array()));
$dtCode = sprintf('if (typeof(AriDataTables) != "undefined") AriDataTables.hideLoadingPane("#%1$s_wrapper");var options = %2$s;options["fnDrawCallback"] = function(oSettings) { adt_DataTable_DrawCallback(oSettings) }; var dt = $("#%1$s").addClass("display dataTable").dataTable(options);%3$s',
$id,
!empty($jsOptions) ? AriJSONHelper::encode($jsOptions) : '',
$fixedColCode
//!empty($jsOptions['bJQueryUI']) ? sprintf('/*$("#%1$s_wrapper").find(".dataTables_wrapper").addClass("ui-widget-content")*/', $id) : ''
); 
[b]$custom_code = sprintf('$("#%1$s_filter input").unbind(); $("#%1$s_filter input").bind("keyup", function(e) { if(e.keyCode == 13) {   dt.fnFilter(this.value)  } });',
$id
);[/b]
$document =& JFactory::getDocument();
if ($loadMethod == 'load')
$document->addScriptDeclaration(';(window["ADTQuery"] || jQuery)(window).load(function() { var $ = window["ADTQuery"] || jQuery;' . $dtCode . [b]$custom_code . [/b]'});');
else
$document->addScriptDeclaration(';(window["ADTQuery"] || jQuery)(document).ready(function($) { ' . $dtCode . [b]$custom_code . [/b]'});');
}



Notice the bold expressions - between tags (which must not be in the code) - which were those I added.

Thank you very much. It would be great Admin adds this option to search by Enter key instead of every keypress in the backend for next version.

I am using server-side processing with a large table (around 49 000 rows).
Last Edit: 2014/11/01 16:20 By adeshjohnson1.
The administrator has disabled public write access.
 
Go to topPage: 1234