[jQuery] Checking to see if a SWF is fully loaded
Hi, Need to find a way to use jquery to check whether or not a swf has been fully loaded before executing a javaScript function. M
[jQuery] Subheadings in tables
Hi am trying to find ways to do this easily with jquery but so far have not found much for what I am looking for. What I would like is an easy way to add subheadings to a table when I perform a sort on the table. The tablesorter plugin works great for sorting the data...but what I would like to do is be able to have a subheading show up in the data table when I sort by a particular column. Any thoughts?
[jQuery] Table grouping
Hi am looking to see if there is an easy way to do the following with jquery. I have values in a table and I want to have the table group data depending on the value of one of my columns. For instance let's say my data looks like this: Type Name Fruit Apple Fruit Pear Veggie Carrot Veggie Peas If I click on the type column I want the data grouped and displayed as follows: Fruit Apple Pear Veggie Carrot Peas
[jQuery] selecting id's with similar names
Hi..am trying to accomplish the following: I have several input elements on my page...there are a few that I want to alter and their id's follow a similar pattern from a naming convention: id="SOMETHING-fieldname" Is there a way to select / filter all of the input elements on the page to only those that start with SOMETHING? M
[jQuery] sortable, draggable and droppable compared with plugin tablednd
Hi can anyone tell me if the jquery ui functions sortable, draggable and droppable can be applied to tables? Similar to what the tablednd plugin does? M
[jQuery] Re: Help populating an array via JSON
Thanks for the tip. I have now added the following 2 functions to my code: function setStates(obj) { this.states = obj; } function getStates() { return this.states; } function StateSuggestions() { $j.getJSON("client/ajax/getMedList.php", function(data){ setStates(data); }); } And things are now working beautifully. M On Feb 4, 10:36 am, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > This is because of the "asynchronicity"...you will only have the correct > data length within the callback function from the getJSON call. Any code > along the same block as the getJSON call will be executed without regard to > the returned data. > > What you can do is abstract the code where you are working with the > this.states array into a separate function, and then call this abstracted > function from the getJSON callback. > > -- Josh > > - Original Message - > From: "Mike Miller" <[EMAIL PROTECTED]> > To: "jQuery (English)" > Sent: Monday, February 04, 2008 9:00 AM > Subject: [jQuery] Help populating an array via JSON > > > Hi, > > > I have a javascript function as follows: > > > function StateSuggestions() { > > > this.states =[]; > > > $j.getJSON("client/ajax/getMedList.php", function(data){ > > alert("inside getJSON" + data.length); > > > this.states = data; > > > alert(this.states.length); //Value says 10 > > > for (i = 0; i < data.length; i++) { > > alert("test" + i); > > > } > > }); > > > alert(this.states.length); // Length here is 0 > > > } > > > I want to populate the this.states array with data being retrieved by > > the getJSON call...however it appears that the value of this.states is > > different depending on whether or not you are inside the JSON call or > > outside of it...not sure why... > > > M
[jQuery] Help populating an array via JSON
Hi, I have a javascript function as follows: function StateSuggestions() { this.states =[]; $j.getJSON("client/ajax/getMedList.php", function(data){ alert("inside getJSON" + data.length); this.states = data; alert(this.states.length); //Value says 10 for (i = 0; i < data.length; i++) { alert("test" + i); } }); alert(this.states.length); // Length here is 0 } I want to populate the this.states array with data being retrieved by the getJSON call...however it appears that the value of this.states is different depending on whether or not you are inside the JSON call or outside of it...not sure why... M
[jQuery] Convert new lines to br
Are there any jquery functions that can take a text value and convert any newlines to tags?
[jQuery] Re: trouble with textarea values
One more thing. I found that if I include an alert function at the end of the saveComments function, the value is saved correctly in IE and FF...however I don't want to have an alert and need to understand why this happens: unction saveComments(){ curVal = $j("#act_progress").val(); origVal = $j("#originalText").text(); newVal = curVal + "\n\n" + origVal; $j("#act_progress").val(newVal); alert(newVal); } On Aug 28, 8:41 am, Mike Miller <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to do the following: > > I have a textarea on a page. I want to preserve the text that has > been previously entered in the text box. My solution has been to do > the following: > > function commentHistory() { > > var originalText = $j("#act_progress").text(); > $j("#act_progress").parent().append("History id='originalText'>"+originalText+""); > $j("#act_progress").text(""); > > } > > The above function displays the original value of the text box in its > own div. When a user goes to submit the form the following function > is called: > > function saveComments(){ > curVal = $j("#act_progress").val(); > origVal = $j("#originalText").text(); > > newVal = curVal + "\n\n" + origVal; > > $j("#act_progress").val(newVal); > > } > > In Firefox this behaves as expected in that the original value is > appended to the new value and both old and new are saved. However in > IE...only the new value is saved. Not sure why this is happening and > need to find a way around it. > > M
[jQuery] trouble with textarea values
Hi, I am trying to do the following: I have a textarea on a page. I want to preserve the text that has been previously entered in the text box. My solution has been to do the following: function commentHistory() { var originalText = $j("#act_progress").text(); $j("#act_progress").parent().append("History"+originalText+""); $j("#act_progress").text(""); } The above function displays the original value of the text box in its own div. When a user goes to submit the form the following function is called: function saveComments(){ curVal = $j("#act_progress").val(); origVal = $j("#originalText").text(); newVal = curVal + "\n\n" + origVal; $j("#act_progress").val(newVal); } In Firefox this behaves as expected in that the original value is appended to the new value and both old and new are saved. However in IE...only the new value is saved. Not sure why this is happening and need to find a way around it. M
[jQuery] Order of execution with onclick and click
Hi, I have an html element that has an onclick attribute set which calls a couple of JS functions. Using jquery I am adding a click event to the same element. Can anyone tell me what the expected execution of js functions will be? ex: $.("#el1").click(function () { anotherFunctionHere; });
[jQuery] Re: Create excel file from table data
Hi...how would you post this back with an ajax request? M On Aug 9, 8:10 am, "Glen Lipka" <[EMAIL PROTECTED]> wrote: > the format of the html can be a regular old tag. To have it point > to Excel you need to change the headers. In php: > header("Content-type: application/vnd.ms-excel; name='excel'"); > header("Content-Disposition: filename=export.xls"); > header("Pragma: no-cache"); > header("Expires: 0"); > > Glen > > On 8/8/07, Mike Miller <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > Am wondering if this is possible with ajax and jquery. > > > I have a table that contains data I would like to export to excel. Is > > it possible using the .ajax() method to post the table data (e.g. $ > > ("#tableid")) to the php page on the backend and have it return an > > excel file? > > > I plan on using the pear module Spreadsheet_Excel_Writer to generate > > the xls file. Any ideas on whether or not this is possible. > > > M- Hide quoted text - > > - Show quoted text -
[jQuery] Create excel file from table data
Hi, Am wondering if this is possible with ajax and jquery. I have a table that contains data I would like to export to excel. Is it possible using the .ajax() method to post the table data (e.g. $ ("#tableid")) to the php page on the backend and have it return an excel file? I plan on using the pear module Spreadsheet_Excel_Writer to generate the xls file. Any ideas on whether or not this is possible. M
[jQuery] Nested Tables
Hi, I am trying to find a way to determine whether or not a particular table element has a child table element. If it does not have any children tables I want to change the class of the table. If it does have children table elements I do not want to do anything. Any ideas? M
[jQuery] Nested Tables Question
Hi, I need to find a quick way to determine whether or not table elements on the page have any children table elements...as I want to change the style class of the innermost table. Any ideas on how best to do this? M
[jQuery] Re: Anything similar to IE's table.moveRow in jquery?
Here is my snippet: var myIndex = $j("#show_medication").parents("tr")... #show_medication is a form element. parents("tr") is the row containing the element Now I want to get the rowIndex Once I have the rowIndex property I would call the moveRow function as follows: $j("#show_medication").parents('table:eq(0)').moveRow(myIndex, myIndex- someNumber, true) Mike On Aug 2, 1:46 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: > Mike Miller wrote: > > Thanks for this...it truly is amazing what jquery can do. A quick > > question for you though regarding the index property. If I want to > > make this more dynamic...do you know how I would find out the value of > > the rowIndex property for the table row I want to move? > > Get it directly from the tr element: > > var rowIndex = $('tr')[0].rowIndex; > > That's shorter than using all jQuery: > > var rowIndex = $('tr').attr('rowIndex'); > > The plugin could of course be changed to take tr elements instead of > passing indices and you don't need to handle the rowIndex: > > jQuery.fn.moveRow = function(from, to, useBefore) { > var trs = this.find(">tr"); > $(from)['insert' + (useBefore && 'Before' || 'After')](to); > return this; > > }; > > Usage: > > var from = $('tr:eq(3)'); // 4th row > var to = $('tr:eq(0)'); // 1st row > $('tbody').moveRow(from, to); // insert 4th row after 1st row > > Is that what you need? > > --Klaus
[jQuery] Re: Anything similar to IE's table.moveRow in jquery?
ok Klaus, Thanks for this...it truly is amazing what jquery can do. A quick question for you though regarding the index property. If I want to make this more dynamic...do you know how I would find out the value of the rowIndex property for the table row I want to move? On Aug 2, 1:17 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: > Klaus Hartl wrote: > > > Mike Miller wrote: > >> Ok...so this is working somewhat...the issue I see now is that the > >> find() in the plugins are finding the "wrong row". > > >> My table structure looks like this: > > >> table > >> - row1 > >> - cell 1 > >> -table > >> row 2 > >> -cell 1 > >>-table > >> row3 > >> -cell 1 > >> -table > > >> When we use the parents("table eq:(0)) I get a reference to the main > >> table containing all of the nested tables...however when using the > >> find...it is finding rows within the nested table. > > >> Is there a way to make the find pertain only to the parent? > > >> Mike > > > Yes, change this.find('tr') to this.find('>tr') > > > (function($) { > > $.fn.moveRowAfter = function(index, afterIndex) > > { > > > this.find(">tr").eq(index).insertAfter(this.find(">tr").eq(afterIndex)); > > return this; > > }; > > > ... > > > })(jQuery); > > > Also the code could be optimized a bit to only perform one search for > > the rows: > > > (function($) { > > $.fn.moveRowAfter = function(index, afterIndex) { > > var trs = this.find(">tr"); > > trs.eq(--index).insertAfter(trs.eq(--afterIndex)); > > return this; > > }; > > $.fn.moveRowBefore = function(index, beforeIndex) { > > var trs = this.find(">tr"); > > trs.eq(--index).insertBefore(trs.eq(--beforeIndex)); > > return this; > > }; > > })(jQuery); > > > Next iteration! :-) The code of both methods looks very similiar, why > > not make a single function out of it, save bytes and reduce possible > > maintenancing: > > > jQuery.fn.moveRow = function(from, to, useBefore) { > > var trs = this.find(">tr"); > > trs.eq(--from)['insert' + (useBefore && 'Before' || > > 'After')](trs.eq(--to)); > > return this; > > }; > > > Usage: > > > $('table tbody').moveRow(4, 1); // insert after is default > > > $('table tbody').moveRow(4, 1, true); // insert before > > > Cheers, Klaus > > Excuse me, to keep the zero based index, use this: > > jQuery.fn.moveRow = function(from, to, useBefore) { > var trs = this.find(">tr"); > trs.eq(from)['insert' + (useBefore && 'Before' || > 'After')](trs.eq(to)); > return this; > > }; > > Usage: > $('table tbody').moveRow(3, 0); > > --Klaus- Hide quoted text - > > - Show quoted text -
[jQuery] rowIndex property
I need to know how to access the rowIndex property of a row in a table and I want to assign that to a javascript variable: Something like: var a = $("#tableRow").
[jQuery] Re: Anything similar to IE's table.moveRow in jquery?
Ok...so this is working somewhat...the issue I see now is that the find() in the plugins are finding the "wrong row". My table structure looks like this: table - row1 - cell 1 -table row 2 -cell 1 -table row3 -cell 1 -table When we use the parents("table eq:(0)) I get a reference to the main table containing all of the nested tables...however when using the find...it is finding rows within the nested table. Is there a way to make the find pertain only to the parent? Mike On Aug 2, 10:44 am, Mike Miller <[EMAIL PROTECTED]> wrote: > Sam...what plugins are you refering to with the moveRowAfter? > > M > > On Aug 2, 2:24 am, Wizzud <[EMAIL PROTECTED]> wrote: > > > > > $('table') ... gets all tables > > $('table').eq(1) ... gets the second table > > $('#formelement').parent().parent().parent() ... gets the 'great-grandad' of > > #formelement > > > or, to look back up the DOM for a table ... > > var _find = $('#formelement'); > > while(!_find.is('table')){ _find = _find.parent(); } > > ...but I would recommend putting another test in this loop, just in case > > #formelement doesn't have a table above it! > > > Mike Miller-13 wrote: > > > > Hi, > > > > Thanks for the tip...the one other question I have related to this > > > that I need to move these rows in a table that has no id. The table > > > does have "form" elements that have id's and I could do something like > > > this in JS > > > > document.getElementById("formelement").parentNode.parentNode.parentNode > > > - this gets a ref to the table > > > > Likewise > > > > document.getElementsByTagName("table") and then navigate to the > > > particular table element I am interested in. > > > > Question now becomes...how do I do either one of those javascript > > > functions I am familiar with...with jquery/ > > > > M > > > > On Jul 31, 2:57 am, Dave Probert <[EMAIL PROTECTED]> wrote: > > >> Or for more detailed movement: > > >> $('tr:eq(3)').insertBefore('tr:eq(1)'); > > >> or > > >> $('tr:eq(2)').insertAfter('tr:eq(5)'); > > >> Note: the numbers are the row count - beginning at 0 (zero) for the > > >> first row. > > > >> Lookup the jquery :xxx qualifiers for more options. > > > >> On Jul 31, 4:16 am, Mike Miller <[EMAIL PROTECTED]> wrote: > > > >> > Haven't been able to find any documentation so far that talks about > > >> > how to move rows around with jquery. Don't really need to sort the > > >> > whole table...rather I want to move one row to another position. Can > > >> > this be done?- Hide quoted text - > > > >> - Show quoted text - > > > -- > > View this message in > > context:http://www.nabble.com/Anything-similar-to-IE%27s-table.moveRow-in-jqu... > > Sent from the JQuery mailing list archive at Nabble.com.- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
[jQuery] Re: Anything similar to IE's table.moveRow in jquery?
Sam...what plugins are you refering to with the moveRowAfter? M On Aug 2, 2:24 am, Wizzud <[EMAIL PROTECTED]> wrote: > $('table') ... gets all tables > $('table').eq(1) ... gets the second table > $('#formelement').parent().parent().parent() ... gets the 'great-grandad' of > #formelement > > or, to look back up the DOM for a table ... > var _find = $('#formelement'); > while(!_find.is('table')){ _find = _find.parent(); } > ...but I would recommend putting another test in this loop, just in case > #formelement doesn't have a table above it! > > > > > > Mike Miller-13 wrote: > > > Hi, > > > Thanks for the tip...the one other question I have related to this > > that I need to move these rows in a table that has no id. The table > > does have "form" elements that have id's and I could do something like > > this in JS > > > document.getElementById("formelement").parentNode.parentNode.parentNode > > - this gets a ref to the table > > > Likewise > > > document.getElementsByTagName("table") and then navigate to the > > particular table element I am interested in. > > > Question now becomes...how do I do either one of those javascript > > functions I am familiar with...with jquery/ > > > M > > > On Jul 31, 2:57 am, Dave Probert <[EMAIL PROTECTED]> wrote: > >> Or for more detailed movement: > >> $('tr:eq(3)').insertBefore('tr:eq(1)'); > >> or > >> $('tr:eq(2)').insertAfter('tr:eq(5)'); > >> Note: the numbers are the row count - beginning at 0 (zero) for the > >> first row. > > >> Lookup the jquery :xxx qualifiers for more options. > > >> On Jul 31, 4:16 am, Mike Miller <[EMAIL PROTECTED]> wrote: > > >> > Haven't been able to find any documentation so far that talks about > >> > how to move rows around with jquery. Don't really need to sort the > >> > whole table...rather I want to move one row to another position. Can > >> > this be done?- Hide quoted text - > > >> - Show quoted text - > > -- > View this message in > context:http://www.nabble.com/Anything-similar-to-IE%27s-table.moveRow-in-jqu... > Sent from the JQuery mailing list archive at Nabble.com.- Hide quoted text - > > - Show quoted text -
[jQuery] Re: Anything similar to IE's table.moveRow in jquery?
Hi, Thanks for the tip...the one other question I have related to this that I need to move these rows in a table that has no id. The table does have "form" elements that have id's and I could do something like this in JS document.getElementById("formelement").parentNode.parentNode.parentNode - this gets a ref to the table Likewise document.getElementsByTagName("table") and then navigate to the particular table element I am interested in. Question now becomes...how do I do either one of those javascript functions I am familiar with...with jquery/ M On Jul 31, 2:57 am, Dave Probert <[EMAIL PROTECTED]> wrote: > Or for more detailed movement: > $('tr:eq(3)').insertBefore('tr:eq(1)'); > or > $('tr:eq(2)').insertAfter('tr:eq(5)'); > Note: the numbers are the row count - beginning at 0 (zero) for the > first row. > > Lookup the jquery :xxx qualifiers for more options. > > On Jul 31, 4:16 am, Mike Miller <[EMAIL PROTECTED]> wrote: > > > > > Haven't been able to find any documentation so far that talks about > > how to move rows around with jquery. Don't really need to sort the > > whole table...rather I want to move one row to another position. Can > > this be done?- Hide quoted text - > > - Show quoted text -
[jQuery] Anything similar to IE's table.moveRow in jquery?
Haven't been able to find any documentation so far that talks about how to move rows around with jquery. Don't really need to sort the whole table...rather I want to move one row to another position. Can this be done?
[jQuery] Populating Select Boxes
Hi, I am new to jquery and have a problem that I cannot explain. I am trying to populate a select box with values from a database. The select box works fine in FF, but nothing appears to happen in IE. Below is my code. Any help on what this is caused by would be greatly appreciated: HTML file: Testing AJAX and PHP $(document).ready(function(){ $("#sector").load("ajax-test2.php?cmd=init"); } ); PHP FILE: (select a person) \n"; while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) { echo "$row[recordid]\n"; } } ?> Note again that this works fine in FF (meaning that the select box is populated), but does not work in IE. Mike