JQuery Datatables Part I: The Phantom Menace - University Of California .

10m ago
11 Views
1 Downloads
1.32 MB
31 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Wade Mabry
Transcription

jQuery Datatables Part I: The Phantom Menace Widget of the Week (WoW) Series

Program sponsored by org.apache.commons.lang.StringUtils org.apache.commons.beanutils.BeanUtils

Things to know jQuery jQuery UI AJAX JSON Datatables.net

jQuery Arguably the most popular JavaScript library in use today Excels at DOM manipulation, event handling, client-server interaction Good cross-browser support Readily extensible through plug-ins and libraries

jQueryUI Library of widgets, effects, events Extension to core jQuery

AJAX “Asynchronous JavaScript and X(HT)ML” Technique (not a framework) often implemented with jQuery Information retrieved from server with JavaScript XMLHttpRequest Displayed on page by manipulating DOM/CSS with JavaScript Major restriction: “same origin policy”

JSON “JavaScript Object Notation” Lightweight data interchange format Arguably human-readable Based on object and array literal syntax

Practical exercise Demonstrate use of jQuery, datatables API, AJAX, and Spring.

Formal requirements

Practical exercise Retrieve data from data store Display data in enhanced table Allow end user to edit existing records Allow end user to add new records All on one page Graceful error handling

Client-server interaction

jQuery.ajax() method Takes care of the messy details of XmlHttpRequest Choice of GET or POST method Pass arbitrary parameters Set callback method Automatically detects return data type: XML, JSON, JavaScript, or HTML

Handling response data in AJAX Can return raw data (XML or JSON) and write to the underlying page with JavaScript Can return HTML fragment and just stick it somewhere on the page

Use the 5Ps approach: Prepare Plan Prototype Plumb Proselytize Secure

Prepare Which widget(s) do I want/need to use? Datatables.net plugin, jQuery UI dialog What docs are available? jQuery online docs, uxt.ucsd.edu, datatables.net What client-side resources are required? jQuery core, jQuery UI, datatables plugin, HTML table What server-side resources are required? Data source, SpringMVC forms, controllers, validators, etc.

Plan Build table data dynamically Use expandable row to view/edit record details Use jQuery UI dialog to add new record Use SpringMVC with AJAX to handle interactions

Prototype Create a basic HTML table, add expandable row enhancement and test implementation of AJAX.

Prototype (cont’d) tbody tr id "123456" td img src "//uxt.ucsd.edu/common/act/1/img/icon arrow right.gif" alt "Expand" / /td td Trinity Lake /td td USBR /td td Trinity /td td 2447700 /td td 1693520 /td td 1721143 /td

Prototype (cont’d) this.src "http://uxt.ucsd.edu/common/act/1/img/icon arrow down.gif"; var guid nTr.id; .ajax({ url: "fakeittilyoumakeit.html", context: nTr, data: { id : nTr.id }, success: function(data) { wowTable.fnOpen(this, data); } });

datatables-static.htm

Prototype (cont’d) "Excellent. Everything is going as planned."

Plumb Create the add and update forms as if you were building a regular SpringMVC app Form taglib Validators Controllers Views

Plumb (cont’d) With one major exception you can’t use a regular form submission! Write AJAX handler using jQuery Return results as JSON and update table data

Plumb (cont’d) In case of validation error, return form view with appropriate messages If callback return type is JavaScript object, assume success, update table If callback return type is string, assume failure, display as HTML

Proselytize Tell your friends!

Secure Use of GET vs. POST method GET method: primarily for retrieving data POST method: anything that modifies data

Secure Use of GET vs. POST method GET method: primarily for retrieving data POST method: anything that modifies data

Alternatives jEditable ml Server-side data model

Optional exercise

Middleware, UI, and database

Coming soon

jQuery core, jQuery UI, datatables plugin, HTML table What server-side resources are required? Data source, SpringMVC forms, controllers, validators, etc. Plan Build table data dynamically Use expandable row to view/edit record details Use jQuery UI dialog to add new record

Related Documents:

Silat is a combative art of self-defense and survival rooted from Matay archipelago. It was traced at thé early of Langkasuka Kingdom (2nd century CE) till thé reign of Melaka (Malaysia) Sultanate era (13th century). Silat has now evolved to become part of social culture and tradition with thé appearance of a fine physical and spiritual .

May 02, 2018 · D. Program Evaluation ͟The organization has provided a description of the framework for how each program will be evaluated. The framework should include all the elements below: ͟The evaluation methods are cost-effective for the organization ͟Quantitative and qualitative data is being collected (at Basics tier, data collection must have begun)

Chapter 1: Getting started with jQuery 2 Remarks 2 Versions 2 Examples 3 jQuery Namespace ("jQuery" and " ") 3 Getting Started 3 Explanation of code 4 Include script tag in head of HTML page 5 Avoiding namespace collisions 6 Loading jQuery via console on a page that does not have it. 8 The jQuery Object 8 Loading namespaced jQuery plugins 8 .

jQuery is the starting point for writing any jQuery code. It can be used as a function jQuery(.) or a variable jQuery.foo. is an alias for jQuery and the two can usually be interchanged for each other (except where jQuery.noConflict(); has been used - see Avoiding namespace collisions). Assuming we have this snippet of HTML -

jQuery is the starting point for writing any jQuery code. It can be used as a function jQuery(.) or a variable jQuery.foo. is an alias for jQuery and the two can usually be interchanged for each other (except where jQuery.noConflict(); has been used - see Avoiding namespace collisions). Assuming we have this snippet of HTML -

It is an unofficial and free datatables ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official datatables.

On an exceptional basis, Member States may request UNESCO to provide thé candidates with access to thé platform so they can complète thé form by themselves. Thèse requests must be addressed to esd rize unesco. or by 15 A ril 2021 UNESCO will provide thé nomineewith accessto thé platform via their émail address.

Archaeological illustration. Cambridge Manuals in Archaeology. Cambridge University Press, 1989. A clearly presented manual describing the various purposes, approaches, conventions, and techniques for archaeological drawings. The number of different types of drawings explained is impressive and necessary for anyone attempting to understand such drawings, especially if attempting to use such .