Revision: 49395
Updated Code
at July 21, 2011 04:12 by vagrantradio
Updated Code
<script type="text/javascript" src="path/to/jquery.dataTables.min.js" ></script> <script type="text/javascript" src="path/to/jquery.getURLParam.js" ></script> <script type="text/javascript" src="path/to/ZeroClipboard/ZeroClipboard.js"></script> <script> jQuery(function() { jQuery(".dataTables_filter :input").after("<button id='clipLink'>Link to search</button>"); // set button for copy var oSearch = $.getURLParam("search"); //utilize the getURLParam plugin to return the ?search= param(s) e = jQuery.Event("keyup"); //set enter event e.which = 13 //enter key if (oSearch != null) { //must be null and not blank for a url jQuery(".dataTables_filter :input").val(oSearch.replace(/%20/g, ' ')).trigger(e)// find all url encoded spaces and replace them, fabricate enter press } jQuery("button#clipLink").zclip({ path: "path/to/ZeroClipboard/ZeroClipboard.swf", copy: function(){ if(jQuery(".dataTables_filter :input").val() == "") { alert("please enter a search term"); return false; } else { var pathname = window.location.href; searchTerm = jQuery(".dataTables_filter :input").val(); result = pathname.substring(5, pathname.indexOf('/')) + "path/to/datatables/page/?search=" + searchTerm; jQuery("#copiedLink").val(result); return jQuery("#copiedLink").val(); } } }); }); </script>
Revision: 49394
Updated Code
at July 21, 2011 04:09 by vagrantradio
Updated Code
<script type="text/javascript" src="path/to/jquery.dataTables.min.js" ></script> <script type="text/javascript" src="path/to/jquery.getURLParam.js" ></script> <script type="text/javascript" src="path/to/ZeroClipboard/ZeroClipboard.js"></script> <script> jQuery(function() { jQuery(".dataTables_filter :input").after("<button id='clipLink'>Link to search</button>"); // set button for copy var oSearch = $.getURLParam("search"); //utilize the getURLParam plugin to return the ?search= param(s) e = jQuery.Event("keyup"); //set enter event e.which = 13 //enter key if (oSearch != null) { //must be null and not blank for a url jQuery(".dataTables_filter :input").val(oSearch.replace(/%20/g, ' ')).trigger(e)// find all url encoded spaces and replace them, fabricate enter press } jQuery("button#clipLink").zclip({ path: "path/to/ZeroClipboard/ZeroClipboard.swf", copy: function(){ if(jQuery(".dataTables_filter :input").val() == "") { alert("please enter a search term"); return false; } else { var pathname = window.location.href; searchTerm = jQuery(".dataTables_filter :input").val(); result = pathname.substring(5, pathname.indexOf('/')) + "path/to/datatables/page?search=" + searchTerm; jQuery("#copiedLink").val(result); return jQuery("#copiedLink").val(); } } }); }); </script>
Revision: 49393
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 21, 2011 04:05 by vagrantradio
Initial Code
<script type="text/javascript" src="path/to/jquery.dataTables.min.js" ></script> <script type="text/javascript" src="path/tojquery.getURLParam.js" ></script> <script type="text/javascript" src="path/to/ZeroClipboard/ZeroClipboard.js"></script> <script> jQuery(function() { jQuery(".dataTables_filter :input").after("<button id='clipLink'>Link to search</button>"); // set button for copy var oSearch = $.getURLParam("search"); //utilize the getURLParam plugin to return the ?search= param(s) e = jQuery.Event("keyup"); //set enter event e.which = 13 //enter key if (oSearch != null) { //must be null and not blank for a url jQuery(".dataTables_filter :input").val(oSearch.replace(/%20/g, ' ')).trigger(e)// find all url encoded spaces and replace them, fabricate enter press } jQuery("button#clipLink").zclip({ path: "path/to/ZeroClipboard/ZeroClipboard.swf", copy: function(){ if(jQuery(".dataTables_filter :input").val() == "") { alert("please enter a search term"); return false; } else { var pathname = window.location.href; searchTerm = jQuery(".dataTables_filter :input").val(); result = pathname.substring(5, pathname.indexOf('/')) + "path/to/datatables/page?search=" + searchTerm; jQuery("#copiedLink").val(result); return jQuery("#copiedLink").val(); } } }); }); </script>
Initial URL
Initial Description
Uses the dataTables filter/search to provide a link to the term being filtered and copies a link to clipboard via ZeroClipboard. Requires the getURLParam, ZeroClipboard and dataTables jQuery plugins. http://www.mathias-bank.de/jQuery/jquery.getParams.js http://www.datatables.net/ http://code.google.com/p/zeroclipboard/
Initial Title
DataTables Link to Filter/Search
Initial Tags
Initial Language
jQuery