jquery,jquery-datatablesRelated issues-Collection of common programming errors
Kyle Hotchkiss
jquery ajax
In the jQuery Docs, it mentions that one can use multiple dataTypes in a jQuery.ajax() request (datatype section). This fits well for what I am trying to do, but it’s not working as expected for me. It’s still parsing the response with the JSON parser but is failing out before it can handle the response as plaintext, like the configuration should require it to. here is my code:jQuery.ajax({dataType: “jsonp html”,url: “http://nomads.ncep.noaa.gov:9090/dods/rap/rap20120821/rap_f01.ascii?ugrdprs[7]
oompahloompah
javascript jquery
Assuming element with id ‘id2’ is a textarea with the following entries:[email protected], [email protected], [email protected] I run this, I am getting values 0, 1 and 2 – why?jQuery(‘#myid’).submit(function() {var temp = jQuery(‘#id2’).serializeArray();var email_arr = temp[0].value.split(‘,’);for (e in email_arr)alert(e);return false; });
Arthur
php javascript jquery
In my UI, users are able to build some javascript objects like:var box = {“width”: “100px”,”height”: “200px”,”click”: function () {alert(“You clicked the box”);} };This is a valid javascript object. Now, i want a way to validate this in php. I can use json_encode/json_decode but it will not work do the the “function() …” thing. Do you have any suggestion?
jahroy
jquery html css for-loop
This question already has an answer here:jQuery Looping and Attaching Click Events4 answersI have a Jquery for loop that is activated when I click an element with the same class apart from itself though it doesn’t do anything.Here is the loop:$(‘.container’).click(function(){for(i = 1; i != 20; i++) {$(‘.container’ + i + ‘ h1 a’).click(function(){$(‘.container:not(.container’ + i +’)’).hide();});} });HTML:<div class=’container container1′><div class=’content’><h1><a href=’#’
jolt
javascript jquery
As the title already mentions, is there a way to check whether a variable is a real jqXHR?I mean (imaginary):var resource = $.get(‘/resource’);if (resource instanceof jqXHR) {// do something }The actual problem I am trying to solve, is for a modal-plugin I’m working on.$(‘#element’).modal({content : function(){return $.get(‘/resource’);} });And, the content variable can be either string or function. In case of string, it will be static, in case of function it will be run every time upon opening
JasCav
jquery post
I am trying to perform the following fadeIn/fadeOut action within the jQuery $.post function.$.post(‘Scenario/SaveScenario’, function (data) {$(‘<div class=”save-alert”>The current scenario has been saved.</div>’).insertAfter($(‘.buttons’)).fadeIn(‘slow’).animate({ opacity: 1.0 }, 2000).fadeOut(‘slow’, function () {$(this).remove();}); });However, this does not work and (apparently) nothing happens. (I put a breakpoint inside the function within Firebug and it is never reached.) The
Johnny Mopp
jquery
I am getting unexpected results with jQuery trying to set the “click” method of a div. Please see this jsfiddle. Be sure to open the console window. Click the word a few times and watch the console output. The click function gets called multiple times when it should only be called once.The commented out code at the end works just fine. Am I doing something wrong? I’m new to jQuery.Here’s the code:function toggleDiv(status) {console.log(“toggleDiv(” + status + “)”);if (status) {$(“#test”).html(“G
Eric
jquery json
I have two functions, functionA() and functionB(), each of which contain a $.getJSON. And, depending on what data is returned from functionA(), functionB() will behave differently. I had been using:functionA(); functionB();However, with this setup, I was sometimes getting some unexpected results from functionB(). My thinking was that functionB()’s JSON call was starting even though functionA()’s JSON call had not been completed. My solution to this was to put functionB() inside of $.getJSON’s
serhalp
jquery jquery-ui svg position
jQuery UI overrides jQuery’s position method with its own, which, as you can see in this fiddle, allows me to display an icon in the top-right corner of a <div> quite easily:icon.position({my: “right top”,at: “right top”,of: “div” });However, in the case of SVG elements (e.g. <rect>), I get unexpected behaviour. For example, as you can see in this test case, the icon shows up around the top left, rather than top right; if you try it with “left top” instead, the icon is positioned of
genesis
javascript jquery ajax json internet-explorer-8
So here is my functionfunction ajax(addr,loading, loadTo, json){addr = addr.replace(‘ ‘, ”);if (loading){$(“#”+loading).fadeIn();}if (json){$.getJSON(addr, function(data){alert(‘whoooo working’); // <— it never goes hereif (loading){$(“#”+loading).fadeOut();}procJSON(data);});return true;} }and I’m calling it withvar postid = $(this).attr(‘data-postid’); ajax(url+’tools/delete/’+postid, ‘loading’+postid, false, true);ajax is sent, image (loading image) is showed, but callback function is n
user2570937
jquery datatables jquery-datatables
I’m trying to use the reloadajax function however when I run it the table says processing and nothing happens. The button and everything works inside the table it just doesn’t reload the table and gets stuck. Any Ideas why?<script type=”text/javascript”> $.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw ) {// DataTables 1.10 compatibility – if 1.10 then versionCheck exists.// 1.10s API has ajax reloading built in, so we use those abilities/
madth3
jquery jquery-datatables
I put the dataTable function initialization inside an object but I don’t get the same result as when I initialize it outside the objectInitialization outside objectvar dataTable = $(‘datatable’).dataTable();Initialization inside objectvar aObject = {dataTable : null,initFunction : function() {// this.dataTable contents is not the same when I initialize dataTable outside the objectthis.dataTable = $(‘datatable’).dataTable();} }Why is this? EDIT: Also, it doesn’t seem to successfully initialise th
Arthur
jquery jquery-datatables
I am using colvis and multi search together, but it has some issue though..Cases: 1. If I uncheck ‘Rendering Engine’, and use multi-search for Engine Version (e.g. with data data 6 or 7), it wont give any data. 2. for multi-serach for CSS grade, it wont search at all I’ve created a jsfiddle here http://jsfiddle.net/cyVjh/script used//Search $(“tfoot input”).keyup(function () {/* Filter on the column (the index) of this element */oTable.fnFilter(this.value, $(“tfoot input”).index(this)); })
madth3
javascript php jquery jquery-datatables
Problem : using dataTables javascript library to display data perfectly fine.Data is retrieved via PHP/mysql and then the table is drawn and the code cycles through the tables as such :JAVA code for dataTables -<script> $(document).ready(function() {$(“#PayMasterResults”).dataTable( {“sPaginationType”: “full_numbers”,”bPaginate”: false,”bJQueryUI” : true,”sScrollY”: “215”,”bLengthChange”: true,”bFilter”: true,”bSort”: false,”bInfo”: true,”bAutoWidth”: false,”sDom”: \'<“H”lTfr>t<“F
madth3
jquery jquery-datatables
In Datatables while viewing in the browser we show n columns. When a user clicks generate excel (implemented using TableTools), I want to hide some unneeded columns. How to hide columns at runtime?
madth3
ruby-on-rails ruby ruby-on-rails-3.1 jquery-datatables
Does anybody have experience with datatables and Rails 3.1!? I tried the simple_datatables 0.2.1 gem from :https://github.com/gryphon/simple_datatableswith kaminari and meta_search 1.1.0 but could not make it working. The table show up without images/css probably due to not properly loaded css styles. Searching in the tables crashes also…. due to some weird search flags it passes to the backend. Example : I have columns ‘name’ and ‘size’ and it passes : ‘search[name_or_sizefalse]’ The backend
Alexander Farber
table header jquery-datatables
I’m trying to create a table where more details can be seen when the plus-image is clicked – similar to the DataTables hidden row details exampleUnfortunately there is a warning being printed as JavaScript alert and also the table header is misplaced – as if there would be too many or not enough table cells in it:I have prepared a simple test case, which will work instantly, when you save it to a file and open it in a browser:<!DOCTYPE HTML> <html> <head> <link type=”text/cs
madth3
jquery asp.net-mvc jquery-datatables
I have an index.cshtml file with a simple table. I downloaded the css file and the min js file for the dataTable plugin. I put the following code in BundleConfig.cs:bundles.Add(new ScriptBundle(“~/bundles/table”).Include(“~/Scripts/jquery.dataTables.min.js”));bundles.Add(new StyleBundle(“~/Content/themes/base/css”).Include(“~/Content/themes/base/jquery.ui.core.css”,”~/Content/themes/base/jquery.ui.resizable.css”,”~/Content/themes/base/jquery.ui.selectable.css”,”~/Content/themes/base/jquery.ui.
madth3
javascript jquery-datatables
Based on the API docs at DataTables site, I created the following javascript function to show only one specific table at a time:function ShowColumn(columnNum) {var table = $(‘#MemberStatisticGrid’).dataTable();$(‘#SelectedMetricList option’).each(function (index) {table.fnSettings().fnSetColumnVis(index, false);});table.fnSettings().fnSetColumnVis(columnNum, true); }However, this fails with the error Uncaught TypeError: Object #<1> has no method ‘fnSetColumnVis’I don’t get why I am getting
aquajach
ruby-on-rails twitter-bootstrap turbolinks jquery-datatables
I have one page with a table enabled with jQuery datatables and also bootstrap (they are fine with each other at the moment). While things get messed up when adding turbolinks to my Rails 4 application. Here’s my application.js file://= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require dataTables/jquery.dataTables //= require dataTables/jquery.dataTables.bootstrap //= require layouts //= require turbolinks //= require_selfIn the layouts.js file, I just simply put a
Web site is in building