Introduction to Essential JavaScript | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (915)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (507)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

Introduction to Essential JavaScript

Bharath M

Essential Studio for JavaScript provides a rich set of controls; all of which have been developed using the jQuery plug-in style, so the controls maintain jQuery-like chaining on every action.

For starters, let’s talk about the basics before getting into how to use any of our JavaScript controls. Here’s a list of what I’m going to discuss:

  1. Default templates
  2. Control creation
  3. Getting and setting properties
  4. Invoking functions
  5. Wiring events

 

Let me start by providing a sample of how to use a default template.

Default Template

This is the default template for Essential Studio for JavaScript. The style sheet is set at the top. Flat Azure is the default theme.

    <title>Getting Started Essential JS</title>
    <!-- Style sheet for default theme (Flat Azure) -->
    <link href="http://cdn.syncfusion.com/js/web/flat-azure/ej.web.all-latest.min.css" rel="stylesheet" />
    <!--Scripts-->
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script src="http://borismoore.github.io/jsrender/jsrender.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/globalize/0.1.1/globalize.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
    <script src="http://cdn.syncfusion.com/js/ej.widgets.all-latest.min.js"></script>

	

      

Control creation

Controls can be created using following syntax in JavaScript:

$("jquery-selector").(); 

This creates a control with the default settings. Here’s an example:

$("#date-input").ejDatePicker(); 

To create a control with an option specified by you, use this syntax:

$("jquery-selector").(options); 

options : <Object Literal>

Here’s an example:

$("#date-input").ejDatePicker({
;
           persist: true
       });

Getting or setting properties

Properties are important to define a control’s behavior. They have been enabled in every control with an option to access or change their values dynamically. This is the syntax to get or set property values:

Getting properties

$("jquery-selector").("model.propertyName")
-Or-
$("jquery-selector").("option", "propertyName"); 

This returns the value of the property with propertyName. Here’s an example using the second syntax:

$("#date-input").ejDatePicker("option", "date");

Setting properties

$("jquery-selector").("model.propertyName", "value");
-Or-
$("jquery-selector").("option", "propertyName", "value");
-Or-
$("jquery-selector").({"propertyName": "value"}); 

This sets the value of a property according to the value give to propertyName. Here’s an example:

$("#date-input").ejDatePicker("option", "date", new Date());

Invoking Functions

Functions can be invoked the same way a property is accessed. Here’s the syntax for invoking functions:

$("jquery-selector").("functionName"); 

This calls the function with no parameter and returns returnValue if the function returns anything, or it will maintain the jQuery chain. Here’s an example:

$("#date-input").ejDatePicker("open");

The following syntax calls the function with parameter values “param1” and “param2”, and then it returns returnValue if the function returns anything, or it will maintain the jQuery chain.

$("jquery-selector").("functionName", "param1", "param2"); 

Here’s an example of this:

$("#date-input").ejDatePicker("option", "cssClass", "custom");

Wiring events

It is important to get a notification for an event whenever changes or actions happen in a control. Events can be wired the same way as jQuery events are bound. The syntax for this follows:

$("jquery-selector").("model.eventName", );
-Or-
$("jquery-selector").on("ej-plugin-nameeventName”, ); 

This binds the event’s “eventName” to the control. Here are examples of both types of syntax:

$("#date-input").ejDatePicker("model.destroy", function(){
       // event handler
       });

$("#date-input").on("ejDatePickerdestroy", function(){
       // event handler
       }); 

Dependencies

Essential Studio for JavaScript has dependencies on the following libraries:

·         jQuery: 1.7.1 and above.

·         JsRender: For templates.

·         jQuery Easing: For animation.

·         jQuery Globalize: For globalization.

You need to add references to all these script files in your projects.

Syncfusion’s content delivery network

Essential Studio for JavaScript libraries and themes are hosted on a content delivery network (CDN) server and are ready for use. Please refer to the following tables:

Script

Name

CDN  Link

ej.widgets.all

http://cdn.syncfusion.com/11.2/js/ej.widgets.all.min.js

Themes

Essential Studio for JavaScript supports 12 themes. They are listed in the following table with their CDN links.

Skin

CDN  Link

Flat Azure (default theme)

http://cdn.syncfusion.com/11.2/js/flat-azure/ej.widgets.all.min.css

Flat Azure Dark

http://cdn.syncfusion.com/11.2/js/flat-azure-dark/ej.widgets.all.min.css

Flat Lime

http://cdn.syncfusion.com/11.2/js/flat-lime/ej.widgets.all.min.css

Flat Lime Dark

http://cdn.syncfusion.com/11.2/js/flat-lime-dark/ej.widgets.all.min.css

Flat Saffron

http://cdn.syncfusion.com/11.2/js/flat-saffron/ej.widgets.all.min.css

Flat Saffron Dark

http://cdn.syncfusion.com/11.2/js/flat-saffron-dark/ej.widgets.all.min.css

Gradient Azure

http://cdn.syncfusion.com/11.2/js/gradient-azure/ej.widgets.all.min.css

Gradient Azure Dark

http://cdn.syncfusion.com/11.2/js/gradient-azure-dark/ej.widgets.all.min.css

Gradient Lime

http://cdn.syncfusion.com/11.2/js/gradient-lime/ej.widgets.all.min.css

Gradient Lime Dark

http://cdn.syncfusion.com/11.2/js/gradient-lime-dark/ej.widgets.all.min.css

Gradient Saffron

http://cdn.syncfusion.com/11.2/js/gradient-saffron/ej.widgets.all.min.css

Gradient Saffron Dark

http://cdn.syncfusion.com/11.2/js/gradient-saffron-dark/ej.widgets.all.min.css

Now you should be able to easily integrate Essential Studio for JavaScript into a new or existing application since it follows the same usage patterns as JQuery. We will post a blog on how to get started using the framework controls shortly.

For those who haven’t tried Essential Studio for JavaScript, simply check out the following links for more details:

List of controls: https://www.syncfusion.com/javascript-ui-controls

Online demo: http://js.syncfusion.com

Essential Studio for JavaScript download: https://www.syncfusion.com/downloads/javascript

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed