[jQuery] Re: Debug Tools - Charles, DebugBar, Firebug Lite

2008-01-05 Thread Phil Glatz

cfdvlpr wrote:
  How do you test in both IE 6 and IE 7?  Are you able to install both
  these on the same machine or do you have more than one machine?

I use the Microsoft Virtual PC:
http://pingv.com/blog/glhines/200712/browser-testing-ie6

It works very well, and since it has its own registry space, there is
a good
degree of isolation from your primary setup.

I agree that testing on IE 5 makes little sense in most cases. I also
use
Firefox as my primary development platform, since it is so rich in
development
tools. I use Firebug, DOM Inspector, and View Formatted Source all the
time.
Apps that pass validation and work in Firefox generally will work in
IE, with
little or no tweaking, if you code conservatively (which also makes
for more
stable sites). You can't ignore IE, since it is the dominant browser,
but I've
had no problem using Firefox as my primary target.




[jQuery] passing cookies in drupal modules

2007-12-18 Thread Phil Glatz

I'm using jquery.cookie.js with Drupal 5.5, and am trying to pass a
value between some jquery code etween a module I wrote and the rest of
the site. I found I could set the cookie in my module, and it would be
set correctly the next time I entered the module. But from rest of the
site, I don't see the cookie. If I do a dump of my current cookie
values when I enter the module, I'm seeing:
  has_js   1
  SESSee9fee6bd0ea8e89bb7b0189ed70ef07
8b8df443d802524079d04a7d391dd278
  collapsiblock-block-menu-87 0
  collapsiblock-block-menu-97 0
  collapsiblock-block-user-1 0

and also see it when I dump cookies in template.php. In my module,
where I set the cookie, I'm seeing the new value correctly, but I
don't see it in the dump from template.php. So I started looking at
options; both modules are in the same domain, so I tried setting the
path to the root:
  $.cookie('mycookie', new_value, {path: '/'});

It still isn't working. Is there something else I need to do, or is
there just no way to pass data with cookies in Drupal?


[jQuery] getting height of frameset window

2007-11-26 Thread Phil Glatz

I'm trying to get the height of the enclosing frameset window in a
page that is using traditional framesets. I am in a function called by
the lower frame. I've tried the dimension plugin, and $
(window).outerHeight() is reporting the height of the window the
current frame is in.

I'm in a frame called myframe, this works:
var ht= top.myframe.$(window).height();

But trying to get the other frame fails, and I can't get top.$
(window).height(0 to report the height of the parent window. What is
the correct syntax?


[jQuery] $ is not defined error

2007-09-18 Thread Phil Glatz

I'm modifying the Drupal img_assist module, and trying to add a little
jquery to the popup it creates. When I do, I get this error:

$ is not defined

When I view source, I see the jquery init code at the bottom of the
html for both the page frameset, and for both of the framed pages (the
popup uses frames).



[jQuery] using tabIndex

2007-07-18 Thread Phil Glatz

I have some fields that may be generated on the fly via DOM, and want
to set the tab index. This isn't working for me:

  $(#elem2).attr(tabindex, $(#elem1).attr(tabindex) + 1);

What would the correct syntax be to make the tabindex of elem2 to be
that of elem1 + 1?



[jQuery] tableSorter - problems with changing the number of rows

2007-07-05 Thread Phil Glatz

I'm using the tableSorter plugin and am having a problem with the
number of rows displayed; I hope I can describe the situation clearly.

I'm building my table dynamically from a local javascript array,
initially populated with a database query. Next, I call the
tableSorter function. So far so good.

Next, I click a button to apply a filter. I clear out my table body's
contents with
  $('#bodytable  tbody').empty();

I fill it up again by looping through my data, but this time skipping
certain rows, ending up with a smaller table. When I click on a column
head to redisplay, it thinks I had the number of rows that were
originally in the table, and doesn't sort correctly. It I have a
filter on when I load the page and end up with 5 rows, then remove the
filter and repopulate the table with ten rows, they all get displayed.
But when I click to sort, only 5 rows are displayed.

I want to avoid having to refresh the page, and am hoping there is
something I can do to tell tableSorter to recalculate the table size
after I have repopulated the table.

I tried setting useCache to false, but that didn't help. I've tried
calling $(#bodytable).tableSorter() again, hoping it would reset
everything, but that didn't help either. Is there a way to force it to
do a recalc?

Thanks for your help, this is a great group.



[jQuery] Re: tableSorter - problems with changing the number of rows

2007-07-05 Thread Phil Glatz

On Jul 5, 4:22 am, Christian Bach [EMAIL PROTECTED]
wrote:
 set useCache: false

 then trigger this after the update.

  $('#bodytable').trigger(updateColumnData);

Thanks, Christian; that did the trick.

When I rebuild the table with more rows, sorting isn't working. If I
was sorting on a particular column, the new column contents don't
always come out in sorted order. Is there another trigger to force a
sort update?

Thanks again, Phil



[jQuery] Re: tableSorter - sorting

2007-07-05 Thread Phil Glatz

Christian Bach wrote:
 And to leak a new feature: it will contain multiple column sorting.

One more suggestion, if it isn't in there already: the ability to
exclude some columns as sortable. The column wouldn't display the
sorting class in the header, and clicking on it would have no effect.
Maybe a list (array) of  column names to use as sortable, or excluded
from sorting.



[jQuery] inner loop values

2007-07-02 Thread Phil Glatz

I'm building a dynamic table, assigning each row a unique ID based on
the value of the counter, and trying to display the row id in an alert
box when a row is clicked:

  $(function() {
for (i=0; i5; i++) {
  var row_id = 'row' + i;
  var rw = 'tr id=' + row_id + 'tdrow ' + i + '/td/tr';
  $('#t1').append (rw);
  $('#t1 tr#' + row_id).click( function()
{ alert(row_id); } );
}
  });

The problem is that although I get a different row_id for the id of
each row, the alert box is always displaying row4. I understand why
this is happening; this was the value at the last pass through the
loop.

What can I do to have it display the correct value?



[jQuery] Re: inner loop values

2007-07-02 Thread Phil Glatz

Thanks for the suggestions, but I haven't found the answer yet.

 Try:
 alert( $(this).attr('id') );

This displays undefined in the alert box.

  var rw = $('tr id=' + row_id + 'tdrow ' + i + '/td/tr').click( 
 function() { alert(row_id); } );

This displays row4 for all rows in the alert box.

 $('#t1 tr#row'+ i).click( function(){ alert( this.id); } );

This displays undefined in the alert box.



original post:


  I'm building a dynamic table, assigning each row a unique ID based on
  the value of the counter, and trying to display the row id in an alert
  box when a row is clicked:

$(function() {
  for (i=0; i5; i++) {
var row_id = 'row' + i;
var rw = 'tr id=' + row_id + 'tdrow ' + i + '/td/tr';
$('#t1').append (rw);
$('#t1 tr#' + row_id).click( function()
  { alert(row_id); } );
  }
});

  The problem is that although I get a different row_id for the id of
  each row, the alert box is always displaying row4. I understand why
  this is happening; this was the value at the last pass through the
  loop.

  What can I do to have it display the correct value?

 --
 Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com



[jQuery] Re: inner loop values

2007-07-02 Thread Phil Glatz

Thanks Ben, works perfectly!

On Jul 2, 6:12 pm, Benjamin Sterling
[EMAIL PROTECTED] wrote:
 Phil,
 This is what I have and get the appropriate rowid in the alert:

 script
 $(function() {
 for (i=0; i5; i++) {
 var row_id = 'row' + i;
 var rw = 'tr id=' + row_id + 'tdrow ' + i + '/td/tr';
  $('#t1').append (rw);
  $('#t1 tr#' + row_id).click( function(){
 alert($(this).attr('id'));
 alert(this.id);
 });
 }});

 /script
 table
 tbody id=t1/tbody
 /table

 I am sure you already knew this, but you have to have the tbody in there, at
 least that is what I figured out from my past experience.



[jQuery] Building a table from an array

2007-06-30 Thread Phil Glatz

Newbie question - can somebody please provide an example or reference
to some existing code on how to create a table from an array of
javascript data, please?

I have an array of data to populate the table tbody; each element in
the array represents a row, and contains an array of the contents of
each column. There could be additional rows for the theader and
tfooter.

I want a function I can pass a table id and the data array, that would
populate the table. I'd also like ot be able to clear all the rows of
the table, so I could insert different data that may contain fewer
rows.

thanks.



[jQuery] displaying an offscreen row

2007-06-23 Thread Phil Glatz
I have a table inside a div; the div has a fixed height and overflow set to
scroll. When the page is opened, the row containing the last selected data
is highlighted, via jquery/DOM.

the problem I have is that if the list (number of rows in the table) is
bigger than can fit in the div, and the current element is below the visible
area, you have to scroll down to see it.

Is there a way to make the div scroll up to make the row I want to see
visible, using DOM?

I don't think so, but thought I'd ask. Do any of the add-ons for jquery that
deal with tables handle this?


[jQuery] waiting for a request to complete

2007-06-11 Thread Phil Glatz

I'm calling $.post to send some text back to a web server, where it
gets logged. The function is something like this:

function send_message(msg) {
  var params = {};
  params['my_message'] = msg;
  $.post(/myhandler.php, params);
}

It calls a php page that appends it to a log. If I view the log in
real time with tail -f log.txt, I can see the messages.

The problem is that if I set up a page to send 5 messages, they aren't
being displayed sequentially; I might see them in the order 2,1,4,3,5
-- and the order is random each time I call the page. What I would
like to do is wait until the post function completes before continuing
with the next message.

Since the post returns an XMLHttpRequest object, I thought I could try
some thing like:

  while ($.post(/myhandler.php, params).status != 200)

But I think that simply keeps calling the function, making things
worse.

How can I query the post request for success, and not exit my function
until it is done?



[jQuery] waiting for a request to complete

2007-06-11 Thread Phil Glatz

Rob suggested:
 Alternatively you could use a globally accessibly variable which states
 whether there is a pending request or not.
 When a request is sent, set it true, when the response is received set
 it false.

Something like this?


var pending = false;

function send_message(msg) {
  pending = true;
  var params = {};
  params['plugger_debug_message'] = msg;
  $.post(/myhandler.php, params, function() { pending = false;});
  while (pending);
}


I had also tried that, but I get a browser timeout after 30 seconds.
Any more thoughts?

thanks



[jQuery] waiting for a request to complete

2007-06-11 Thread Phil Glatz

Rob wrote:
Where you're checking the request status you're creating a new request
each time.
You need to store the XHR object from the request and use that
(untested):

var xhr = $.post(/myhandler.php, params);
while (xhr.status != 200);


With Firefox 2, I'm getting this error:

[Exception... Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status] nsresult:
0x80040111 (NS_ERROR_NOT_AVAILABLE) location: JS frame ::
http://pglatz.lifewire.com/sites/pglatz.lifewire.com/modules/plugger/plugger_category.js
:: plugger_debug :: line 194 data: no]
[Break on this error] while (xhr.status != 200);

This is part of a Drupal site, if that makes any difference.

thanks



[jQuery] Dragging from a Drupal block to tinyMCE

2007-05-29 Thread Phil Glatz

I'm using Drupal 5.1 and jquery to build a site where members can
create content. I wrote a module to display a list of available images
and videos in a list in a block. I'd like to be able to select an item
from the list and drag it into the article body textarea, and
wondering if this can be done without modification of core Dupal
functions. If dragdrop is not possible, could this be done by
selecting an item and clicking in the textarea?

I'd appreciate any example or tutorials on how this could be done.
thanks