Top Banner
Working with jQuery UI Widgets
21

Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Jul 09, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Working with jQuery UI Widgets

Page 2: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native
Page 3: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native
Page 4: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native
Page 5: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

21.06.18 Working with jQuery UI Widgets 5

Page 6: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

21.06.18 Working with jQuery UI Widgets 6

Page 7: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

What do they have in common?

Page 8: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

The widget factory

Page 9: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

21.06.18 Working with jQuery UI Widgets 9

https://learn.jquery.com/jquery-ui/widget-factory/

Page 10: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Hey Dude, where’s my widget?

Page 11: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Getting all widget instances on a page

Widgets in jQuery UI have their own selectors. These selectors allow the developer to select widgets by type.

21.06.18 Working with jQuery UI Widgets 11

$(':<namespace>-<widgetname>');//Examples$(':apex-interactivegrid');$(':ui-datepicker');

Page 12: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Widgets are placed under a namespace

21.06.18 Working with jQuery UI Widgets 12

Namespace Purpose Widgets

$.ui Native jQuery UI widgets

datepicker, dialog, …

$.apex Oracle APEX Widgets treeView, menu, interactiveGrid, …

$.fullCalendar The calendar region widget

fullCalendar

$.oj Oracle JET widgets ojChart, ojGantt, …

$.kscope Our own widgets for Kscope

none

Page 13: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

And has many public methods and functions

21.06.18 Customizing the Interactive Grid with plug-ins 13

$.apex.interactiveGrid.prototype

Page 14: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Using a page region widget method

21.06.18 Working with jQuery UI Widgets 14

letview=apex.region('task_due_dates').widget().fullCalendar('getView');//orin18.1letview=apex.region('task_due_dates').call('getView');

Page 15: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Using a page item widget

21.06.18 Working with jQuery UI Widgets 15

$('#P1_DATE').datepicker('getDate');//returns:ThuJun14201800:00:00GMT+0200(CentralEuropeDaylightTime)

Page 16: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

When to use them

21.06.18 Working with jQuery UI Widgets 16

Changing options

Executing methods

Acting on events

Page 17: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Changing options

The options are part of the widget's state, so we can set options after initialization as well.

21.06.18 Working with jQuery UI Widgets 17

apex.region('mychart').call('option','orientation','horizontal');

Page 18: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Executing methods

21.06.18 Working with jQuery UI Widgets 18

apex.region('emp').call('refresh');

Page 19: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Acting on events

21.06.18 Working with jQuery UI Widgets 19

Event names always start with the widget name in lowercase All widgets have a create event

$('#emp').on('interactivegridcreate',function(event,data){});$('#emp').on('interactivegridselectionchange',function(event,data){console.log(data);});

Page 20: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Advanced usage

Extending a widget

21.06.18 jQuery UI Widgets in APEX 18.1 20

$(document).ready(function(){$.widget('apex.interactiveGrid',$.apex.interactiveGrid,{refresh:function(){alert('HelloKscope,Ishouldrefreshnow..');this._super();}});});

Page 21: Working with jQuery UI Widgets - dietmaraust.comdietmaraust.com/downloads/presentations/2018/2018... · 12 Working with jQuery UI Widgets 21.06.18 Namespace Purpose Widgets $.ui Native

Thank you