Ajax Updates

Ajax Updates


Tabs with Moo tools plugin

Posted: 01 Sep 2009 10:20 AM PDT

This is MooTabs! Using a slightly modified CSS file and Fx.Transitions.Back.easeOut as changeTransition
27feb0805 Tabs with Moo tools plugin
 CSS |  copy code |? 
01
.mootabs_title { 
02
	list-style-image: none; 
03
	list-style-type: none; 
04
	margin: 0px; 
05
	padding: 0px; 
06
	height: 24px; 
07
 
08
} 
09
 
10
.mootabs_title li { 
11
	float: left; 
12
	background-color: transparent; 
13
	padding: 2px 8px 2px 8px; 
14
	margin-right: 2px; 
15
	cursor: pointer; 
16
	color: #fff; 
17
	font-family: "Trebuchet MS"; 
18
	font-size: 12px; 
19
	height: 24px; 
20
	line-height: 24px; 
21
} 
22
 
23
.mootabs_title li.active { 
24
	border-top: 3px solid #55FF2A; 
25
} 
26
 
27
.mootabs_panel { 
28
	display: none; 
29
	position: relative; 
30
	width: 100%; 
31
	top: -1px; 
32
	font-family: "Trebuchet MS"; 
33
	clear: both; 
34
	color: #fff; 
35
	overflow: auto; 
36
	text-align:left; 
37
	padding: 3px; 
38
} 
39
 
40
.mootabs_panel.active { 
41
	background-color: #272822; 
42
	display: block; 
43
 
44
} 
45
 
46
.mootabs_title li.over { 
47
	border-top: 3px solid #30DA06; 
48
} 
49

Demo: http://www.silverscripting.com/mootabs/style2.html
Download: http://www.silverscripting.com/mootabs/mootabs1.1.style2.css
Source: http://www.silverscripting.com/mootabs/style2.html
tafbutton blue16 Tabs with Moo tools plugin

Related Listings:

  1. MooTabs with Ajax MooTabs is a tiny(3kb) class for MooTools. As the...
  2. Sliding Tabs using Moo Tools Plugin The script relies on width and height of tabs and...
  3. Pamoorama – Image Moo tools plugin Pamoorama is a simple script that aims at spicing...

Coolite Studios – Web Control with Ajax

Posted: 01 Sep 2009 09:52 AM PDT

A huge new feature to be introduced with the next release (v0.7) of the Coolite Toolkit is the [AjaxMethod] Attribute.

Converting a standard server-side Method into an “AjaxMethod” enables the Method to be called directly from your client-side JavaScript. No PostBack, no page flicker and all communication is performed through lightweight AJAX + JSON.

The [AjaxMethod] Attribute can be applied to any public or public static .NET server-side Method (C#, VB, etc.).

An [AjaxMethod] is similar in functionaltiy to the ASP.NET [WebMethod] Attribute except an AjaxMethod is optimized to serialize and return data in an easily consumed JSON response.
Getting Started Basic Example

The following code sample demonstrates a simple AjaxMethod returning a string to the client.

 Javascript |  copy code |? 
1
[AjaxMethod] 
2
    public string SayHello(string text) 
3
    { 
4
        return "Hello " + text; 
5
    } 
6
Once the "SayHello" Method has been tagged with the [AjaxMethod] Attribute, the Method is now available to be called directly from JavaScript. The following sample demonstrates calling "SayHello" by clicking a hyperlink.
 HTML |  copy code |? 
1
<a href="#" onclick="Coolite.AjaxMethods.SayHello('World')">Click Me</a>
Once clicked, theSayHello JavaScript function will make an Ajax request back to the server and invoke the server-side SayHello Method. The string "Hello World" would be sent back to the browser packaged in a lightweight JSON object.
 Javascript |  copy code |? 
1
{result:"Hello World"}

Calling SayHello returns a total response size of less than 25 characters... that's tight.
Success Handling

If the server-side AjaxMethod returns an object, we need to provide a way of handling that response. As the last parameter of the JavaScript function you can pass in an optional config object with a success handler.

Lets elaborate on our example by adding a Listener to an Control and include the optional config object with a success function defined to alert the result.
 HTML |  copy code |? 
01
<ext :Button ID="Button1" runat="server" Text="Say Hello"> 
02
        <listeners> 
03
            <click Handler=" 
04
                Coolite.AjaxMethods.SayHello('World', { 
05
                success: doAlert 
06
                });" /> 
07
        </listeners> 
08
    </ext> 
09
 
10
    <script type="text/javascript"> 
11
        var doAlert = function (result) { 
12
            alert(result); 
13
        } 
14
    </script> 
15
So, lets break this down a bit. First off, the argument signature for the SayHello JavaScript function would be described as follows:
 Javascript |  copy code |? 
1
SayHello(string text, object config)

The text argument is pretty simple, as it's the string sent into the server-side SayHello C# Method.

The config argument is a JavaScript object literal made up of a collection of name:value pairs. The JavaScript object literal is similar in concept to .NET Anonymous types. It's a "thing" (ie. object) with some properties.

In the example above, the success property is set with the name of a JavaScript function to call upon a successful response from the server.

Whatever object is returned from the server-side AjaxMethod is serialized into JSON, and passed as the return result into the success JavaScript function. Using our SayHello example, the result is passed to the doAlert JavaScript function.

The success function can also be coded inline within the config object.

 Javascript |  copy code |? 
01
<ext :Button ID="Button1" runat="server" Text="Say Hello"> 
02
        <listeners> 
03
            <click Handler=" 
04
                Coolite.AjaxMethods.SayHello('World', { 
05
                    success: function (result) { 
06
                    alert(result); 
07
                    } 
08
                });" /> 
09
        </listeners> 
10
    </ext> 
11

Summary

Adding the [AjaxMethod] Attribute to your server-side Method enables the Method to be called from client-side JavaScript running in a browser, without having to perform a PostBack. The request from the client to the web server is made using Ajax and the response from the server back to the client is packaged as a JSON object.

We're just scratching the surface here, so in future posts we'll dive deeper into performance tuning and advanced AjaxMethod configuration options.

More information and code samples demonstrating AjaxMethods are available in the recently updated Examples Explorer.

The Coolite Toolkit is a suite of powerful Ajax enabled ASP.NET Web Controls which simplify the development of Web Applications. The Coolite Toolkit includes the Ext JS JavaScript Framework and together are dual licensed with an open-source "Community" option or closed-source "Professional" version

Demo: http://www.coolite.com/examples/
Download: http://www.coolite.com/download/Coolite.Toolkit.Community.Edition.0.8.1.zip
Source: http://www.coolite.com/
tafbutton blue16 Coolite Studios   Web Control with Ajax

Related Listings:

  1. File Tree Panel – Easy Management Files File Tree Panel is client-server application where client (browser) provides...
  2. Preload With Ajax and Json Web applications have made huge leaps and bounds in improving...
  3. Ajax Shout box – Very Simple This script is based on jQuery library and Form plugin.It’s...

jTruncate : jQuery Plugin

Posted: 01 Sep 2009 09:02 AM PDT

This is the demonstration page for the jTruncate plugin for jQuery. If you are looking for the jTruncate homepage.
Plain Jane Example

jTruncate is called in the same way that most other jQuery plugins are called. The example below is using the following code, that accepts all the default options.

 Javascript |  copy code |? 
1
$().ready(function() { 
2
 $('#example1').jTruncate(); 
3
}); 
4
jTruncate Options

jTruncate allows you to customize nearly every aspect of the truncation operation. The following options are provided:

length: Defaults to 300
The number of characters to display before truncating.
minTrail: Defaults to 20
The minimum number of "extra" characters required to truncate. This option allows you to prevent truncation of a section of text that is only a few characters longer than the specified length.
moreText: Defaults to "more"
The text to use for the "more" link.
lessText: Defaults to "less"
The text to use for the "less" link.
ellipsisText: Defaults to "..."
The text to append to the truncated portion.
moreAni: Defaults to an empty string
The speed argument for the show() method (as specified here).
lessAni: Defaults to an empty string
The speed argument for the hide() method (as specified here).

Custom jTruncate Example


The following example demonstrates how to override the defaults described above.
 Javascript |  copy code |? 
01
$().ready(function() { 
02
 $('#example2').jTruncate({ 
03
  length: 200, 
04
  minTrail: 0, 
05
  moreText: "[see all]", 
06
  lessText: "[hide extra]", 
07
  ellipsisText: " (truncated)", 
08
  moreAni: "fast", 
09
  lessAni: 2000 
10
 }); 
11
}); 
12
 
13
Special Considerations

Note that if you override the default animation options, you will notice a "new line" inserted at the point of truncation. This is because the hide/show methods require the animated element to be block level, and thus will begin on its own line.

Also note that jTruncate chooses the split location by starting at the length you specify (or the default) and then finds the next space. This is to prevent truncation in the middle of an html tag. This implies that the text needs to have spaces in it (duh), and that any tags within the truncated text cannot contain a space (i.e.

= bad).


Demo: http://blog.jeremymartin.name/2008/02/jtruncate-in-action.html
Download: http://jtruncate.googlecode.com/svn/trunk/jquery.jtruncate.pack.js
Source: http://blog.jeremymartin.name/2008/02/jtruncate-in-action.html

tafbutton blue16 jTruncate : jQuery Plugin

Related Listings:

  1. jQuery plugin Tooltip Script Replacing standard tooltips is easy: Just include the script on...
  2. Expander Plugin with Jquery The Expander Plugin is a simple little jQuery plugin to...
  3. Impromptu – prompt jQuery plugin for Forms jQuery Impromptu is an extention to help provide a more...

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.