[mochikit] Re: Conceptual assistance on periodically updating table contents from database

2007-10-07 Thread alex clemesha
On 10/5/07, onmountain [EMAIL PROTECTED] wrote:


 Hi. New to Turbogears and Mochikit (did I just hear everyone clicking
 the back key? :-)
 I am teaching myself by doing an in/out sign in board, which I have
 gotten to the point where I have a table that I can sort, as well as
 update by clicking on the edit button for the inout_status field.
 Really think TG and Mochikit are cool
 My stumbling point now is how to keep the table contents up-to-date
 (showing all the correct inout_status values as people update their
 own status) without doing a page refresh.


without doing a page refresh = ajax .
but maybe you already new that ;)

Is there a timer function
 (I think that calllater might be it???).


yes, you can use the callLater function,
especially for idea #2, see below.

 I have two ideas here:

 1) Have TG maintain a variable (change_flag) that the edit button(s)
 on all the user screens will set as TRUE when the user changes
 inout_status.  Each screen could then periodically check for that
 change_flag == true, and if so, the table value could all be updated?

 2) Just have a timer in Mochikit that would trigger periodic updates
 to ALL the table contents.


maybe something like this:


var REFRESH_INTERVAL = 120; //120 seconds, every 2 minutes.
//Warning: dont make interval to short,or you will have unhappy browsers

var updateTableWithNewData = function(res){
  //'res is the data from an ajax query for your table data
 // insert new data in table logic here *See MochiKit.DOM*
}

var getNewTableData = function(url){
//url is the /path/that/serves/new/tabledata
d = loadJSONDoc(url); //could be 'doXHR' or similar
d.addCallback(updateTableWithNewData);
}

callLater(REFRESH_INTERVAL, getNewTableData);

You will need to start the 'refresh loop' with some 'onload' function as
well.
Hope this helps.
Alex

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: designing netvibes type look and feel

2007-10-07 Thread Stan Rogers

The Netvibes content boxes use background images. The trick is that
they use several -- one for the top shaded area and box bounding (no-
repeat), one for the bottom (no-repeat again, and includes the drop
shadow), and one for the box body (repeat-y). If the boxes/panels
are fixed width, it's easy. If you want to make the components width-
resizable, then you need to include styling-only elements (that is,
elements with no semantic significance that only exist so they can
contain background images).

On Sep 19, 2:47 am, Aziz Rehmatullah [EMAIL PROTECTED] wrote:
 Hey guys,

 I am looking for some help designing a javascript component. What I am
 looking for is a square, resizeable glossy looking box (similar to the ones
 inwww.netvibes.comor pageflakes.com). I do not want them to be movable but
 it will be great if they are resizeable.

 Is there a way I can do this using mochikit/any other library? If these are
 not movable compnents, is it possible for me to develop a similar look and
 feel (slightly raised, glossy, shaded background etc) using CSS? One option
 that comes to my mind is making opaque images with the desired look and feel
 and use them as background images in various DIVs. However, in this case,
 resizing will be a major issue.

 I would appreciate any pointers on this. Also, please let me know if there
 are any libraries that can help me achieve such a look and feel.

 Thanks and Regards,

 Aziz

 --
 Be the change you want to see in the world.
 ~Mahatma Gandhi


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: Comparing dates

2007-10-07 Thread Stan Rogers

More to the point here, Date() returns a string the way you are using
it, not a date object. If you want a date object to compare, use the
new keyword. (Date objects can be directly compared with ,  and =,
since they have a single scalar data member and collapse to a
milliseconds-after-epoch value on comparison.)

On Aug 28, 4:32 pm, Bob Ippolito [EMAIL PROTECTED] wrote:
 On 8/28/07, grum [EMAIL PROTECTED] wrote:





  Hi everyone,

  I'm having problems comparing the following:

  isoTimestamp(2007-08-13T04:00:00+00:00)

  which gives me:

  Mon Aug 13 2007 00:00:00 GMT-0400 (EDT)

  and:

  Date()

  which (right now) gives me:

  Tue Aug 28 2007 16:14:12 GMT-0400 (EDT)

  ie. isoTimestamp(2007-08-13T04:00:00+00:00)  Date() is returning
  false.

  I think it's something to do with the lack of quotes around the result
  of isoTimestamp - though quite what that means i'm not sure.  Please
  someone help me out, i really need to be able to compare these dates.

 JavaScript's built-in comparison operators are no good for comparing
 objects, only strings and numbers. This is why MochiKit.Base.compare
 exists.

 -bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---