Archive

Tag Archives: jquery

I recently created custom widget for Django Admin area.

Weeklyhours

It’s used to edit pickled set of weekly hours range day by day. There is also ability to check a day as closed. Pure client side control was implemented as jQuery plugin for using with Django:

weekly_hours.js, weekly_hours.css

Server side model and widget:

models.py, admin.py

 

 

Advertisements

Several months ago I was involved into discussion about the best way to implement realtime light-weight web chat like FB or GTalk right in Web.
In way like Comet or WebSocket. And now I have prety simple but robust solution. I’m talking about node.js + socket.io.

There is working example (not even pure chat but rather web echo service). To try it you need to install node.js, npm and then socket.io by npm. Then just run sudo node echo_server.js and go to http://localhost:8000.

Linux needs root’s privileges to server correctly flash client as bridge (one of transport layers provided by socket.io) on port 843.

One more interesting feature in this example is auto-scroll-bottom widget on client side like real chat messages box.

Basically, this is just test example or start point to implement real chat service or multiplayer game.

 

 

There is interesting trick to catch ASPX runat=”server” controls by jQuery selector on client side:

<asp:DropDownList id=”ddlFirst” runat=”server”>
</asp:DropDownList>

jQuery(‘select[id$=ddlFirst]’).val();

Regular jQuery(‘#ddlFirst’) doesn’t work because on client side ASPX used ClienID like ‘Something_ddlFirst’ instead of ‘ddlFirst’.