# jQWidgets documentation for JavaScript and jQuery (full text) > Guides, tutorials and API references for the jQWidgets JavaScript and jQuery UI components: data grids, charts, scheduler, Gantt, Kanban, editors, lists, navigation and layout. Version 27.1.0. Every page has a Markdown copy: its URL followed by .md. Live demos with source code: https://www.jqwidgets.com/jquery-widgets-demo/ Install: `npm install jqwidgets-scripts` and load the scripts from node_modules/jqwidgets-scripts/jqwidgets/, or from the jsDelivr CDN (https://cdn.jsdelivr.net/npm/jqwidgets-scripts/jqwidgets/). jQuery is optional: jqxcore.js works on its own, and jQuery 3 and 4 also work. Start with the complete guide for AI assistants: https://www.jqwidgets.com/llms-full.txt (installation and tested examples for every framework, API conventions, themes, the AI features, the MCP server and every component in one file). More files: https://www.jqwidgets.com/jquery-widgets-documentation/llms-full.txt (every guide in full, and the API in one line per member: for search and retrieval, larger than one context window), https://www.jqwidgets.com/jquery-widgets-documentation/llms-api.txt (the API of every component, one line per member), https://www.jqwidgets.com/jquery-widgets-documentation/llms/.txt (everything about one component, its full API included, e.g. https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxgrid.txt). To read in one context: the complete guide above, then llms-api.txt, then the files of the components you use. License: a free Community License covers the components except Grid, TreeGrid, PivotGrid, Scheduler, DataTable, Chart, Gantt, Editor and Kanban; commercial licenses (perpetual, with source code) cover all of them: https://www.jqwidgets.com/license/ ## Start here --- ### JavaScript UI components for data-heavy web apps Source: https://www.jqwidgets.com/jquery-widgets-documentation/ > JavaScript UI components for data-heavy web apps: data grid, scheduler, Gantt, Kanban, 30+ chart types and pivot tables. 66 components, 900+ live demos. jQWidgets for JavaScript · version 27 · no jQuery required Grids that stay fast with 100,000 rows, a scheduler, Gantt and Kanban boards, 30+ chart types, pivot tables and every editor a business app needs: 66 components for plain JavaScript or jQuery, from npm or a CDN, with one API across Angular, React and Vue. - **66** components - **900+** live demos with source - **45+** themes, light and dark - **4** frameworks, one API All 66 components, by category #### Why teams build with jQWidgets - Fast with big data Virtual scrolling, paging and server-side modes keep a grid of 100,000 rows responsive, and live cell updates take milliseconds. [The 100,000-row tutorial](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-large-data.htm) - One API, four frameworks The same components and options in JavaScript, Angular, React and Vue, so what you learn carries over: [React](https://www.jqwidgets.com/react-components-documentation/), [Angular](https://www.jqwidgets.com/angular-components-documentation/), [Vue](https://www.jqwidgets.com/vue-components-documentation/). - Plain JavaScript first ES modules or a script tag, any bundler or none. jqxcore.js brings its own small DOM layer, so jQuery is optional. [Install options](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/package-managers/npm-tutorial.htm) - Themes, light and dark Fluent, Material, Tailwind and 35+ more themes, set per component, or your own from the Theme Builder. [Theme Builder](https://www.jqwidgets.com/themebuilder/) - Accessible and accountable ARIA roles and keyboard navigation in the components; a published security policy, advisories and a software bill of materials. [Security and compliance](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/compliance/index.htm) - Ready for AI An AI-assisted Grid and a Chat component for your apps, and an MCP server and llms.txt that let coding assistants write correct jQWidgets code. [The MCP server](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/mcp/mcp-server.htm) #### Getting started **jQuery is not required.** `jqxcore.js` carries the small DOM layer the components use, so `$('#grid').jqxGrid({ … })` works on a page with no jQuery. If your page already loads jQuery 3, jQWidgets uses it. #### Quick start A sortable, filterable grid on a plain HTML page - no build step, loaded from the jsDelivr CDN: ```html
``` `jqx-all.js` contains every component, which is the quickest way to start. In production, load only the files a page uses - each component's getting-started page lists them - or use a bundler. #### Install with a package manager ```bash npm install jqwidgets-scripts ``` With a bundler such as Vite, import the styles and the library once, then use the components from any module: ```javascript import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css'; import 'jqwidgets-scripts/jqwidgets/styles/jqx.fluent.css'; import 'jqwidgets-scripts/jqwidgets/jqx-all'; $('#grid').jqxGrid({ theme: 'fluent', width: '100%' /* … */ }); ``` TypeScript definitions for every component and option are in `jqwidgets-scripts/jqwidgets-ts/jqwidgets.d.ts`. #### Frameworks - [React](https://www.jqwidgets.com/react-components-documentation/) - typed components for React 19, used with hooks. - [Vue](https://www.jqwidgets.com/vue-components-documentation/) - Vue 3 Single-File Components for `

``` The script runs at the end of `body`, after the button exists, so it does not need a ready handler. If you put scripts in `head`, wrap the code in `$(function () {... })` or add `defer` to the script tags. Every widget page in these docs lists the files the widget needs. For example, a sortable, paged grid needs `jqxdata.js`, `jqxgrid.js`, `jqxgrid.sort.js` and `jqxgrid.pager.js` plus their helpers; see [Grid getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-getting-started.htm). #### Themes Always include `jqx.base.css`. Add one theme file and pass its name in the `theme` setting of each widget, for example `theme: 'material'` with `jqx.material.css`. Without a `theme` setting, widgets use the base theme. #### Supported browsers jQWidgets 27 supports all current evergreen browsers (Chrome, Edge, Firefox, Safari), on desktop and mobile. Touch input and high-density screens work without extra settings. #### Where to go next - [Grid getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-getting-started.htm) and the other widget guides in the menu on the left. - [Data adapter](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm): load local or remote data into any data-bound widget. - [npm and bundlers](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/package-managers/npm-tutorial.htm), and [ES modules and import maps](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/requirejs/requirejs_tutorial.htm). - [Bootstrap 5.3 with jQWidgets](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/bootstrap/jqwidgets-with-twitter-bootstrap.htm). - [Mobile apps with Capacitor](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/phonegap/jqwidgets-mobile-phonegap-application-for-android.htm). - [Accessibility](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/accessibility/jqwidgets-accessibility-overview.htm). - Live demos: [JavaScript](https://www.jqwidgets.com/jquery-widgets-demo/), [React](https://www.jqwidgets.com/react/), [Vue](https://www.jqwidgets.com/vue/) and [Angular](https://www.jqwidgets.com/angular/). --- ### jQuery and jQWidgets Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jquerybasics/jquerybasics.htm > jQWidgets grew up as a set of jQuery plug-ins, which is why widgets are created with $('#id').jqxGrid({...}). jQWidgets grew up as a set of jQuery plug-ins, which is why widgets are created with `$('#id').jqxGrid({...})`. Today jQuery is optional: you can use jQWidgets with or without it, with the same code. When you use it, jQuery 3 and jQuery 4 both work. #### Without jQuery `jqxcore.js` contains its own jQuery-compatible core. When the page has no jQuery, it defines `$` for you, so a page needs nothing but the jQWidgets files. ```html jQWidgets without jQuery
First panel
Second panel
``` The same `$` selects elements, binds events and creates widgets. No other script is loaded. #### What the built-in $ provides The built-in core covers the part of the jQuery API that widgets and typical page code use: | Area | Available | | --- | --- | | Selectors | Full CSS selectors: `$('div.home')`, `$('#home')`, `$('[href]')`, `$('input:checked')`; traversal with `find`, `children`, `parent`, `closest`, `siblings`, `next`, `prev`, `filter`, `not`, `eq`, `first`, `last`, `each` | | DOM | `html`, `text`, `val`, `attr`, `prop`, `data`, `append`, `prepend`, `before`, `after`, `remove`, `empty`, `clone`, `wrap` | | CSS and size | `css`, `addClass`, `removeClass`, `toggleClass`, `hasClass`, `width`, `height`, `outerWidth`, `offset`, `position`, `scrollTop` | | Events | `on`, `off`, `trigger`, shortcuts such as `click`, and `$(function () {... })` for DOM ready | | Effects | `show`, `hide`, `toggle`, `fadeIn`, `fadeOut`, `animate`, `stop` | | Utilities | `$.extend`, `$.each`, `$.map`, `$.grep`, `$.isPlainObject`, `$.Deferred`, `$.when` | Ajax helpers (`$.ajax`, `$.get`, `$.getJSON`) are not part of it. Load data into widgets with `new jqx.dataAdapter({ datatype: 'json', url: '/api/…' })`, which has its own request code, and use the browser's `fetch()` for anything else. ```javascript async function saveOrder(order) { const response = await fetch('/api/orders', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(order) }); if (!response.ok) { throw new Error('Saving failed: ' + response.status); } return response.json(); } $('#saveButton').on('click', async function () { const saved = await saveOrder({ product: 'Espresso', quantity: 2 }); $('#status').text('Saved order ' + saved.id); }); ``` #### With jQuery 3 or 4 If your page already uses jQuery, jQWidgets uses that copy instead of its own core. Load jQuery **before** `jqxcore.js`; `jqxcore.js` checks for `window.jQuery` when it runs. ```html jQWidgets with jQuery 3
``` The page above loads jQuery 3.7.1. For jQuery 4, load `https://cdn.jsdelivr.net/npm/jquery@4.0.0/dist/jquery.min.js` instead; nothing else changes. jQuery 4 removed old helpers such as `$.isArray`, `$.trim` and `$.parseJSON`. jQWidgets 27.1.0 no longer uses them, so only your own code may need changes. Include jQuery (3.5.0 or later, or 4) only when you need it, for example when: - the page already uses jQuery plug-ins or jQuery UI; - existing code relies on `$.ajax`, `.load()` or other jQuery features that the built-in core does not provide; - a CMS loads jQuery anyway, as WordPress does. See [jQWidgets in WordPress](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/wordpress/wordpress.htm). Do not use jQuery 1.x or 2.x. They are no longer maintained and have known security issues. #### jQuery in no-conflict mode When jQuery runs in no-conflict mode, `$` belongs to another library and you call jQuery through `jQuery` or an alias. Widgets are attached to jQuery, so use the same name to create them: ```javascript const jq = jQuery.noConflict(); jq(function () { jq('#saveButton').jqxButton({ width: 150, height: 36 }); }); ``` If you cannot be sure which library a page loads first, `jqxcore.js` also exposes the object it attached the widgets to as `window.jqxBaseFramework`: jQuery when it was present, otherwise the built-in core. #### Next steps - [Introduction to jQWidgets](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/introduction/introduction.htm): install and create a first widget. - [Data adapter](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm): bind widgets to local and remote data. - [ES modules and import maps](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/requirejs/requirejs_tutorial.htm). --- ### Accessibility in JavaScript and jQuery Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/accessibility/jqwidgets-accessibility-overview.htm > jQWidgets widgets are made to work with a keyboard and a screen reader. jQWidgets widgets are made to work with a keyboard and a screen reader. When you create a widget, it adds WAI-ARIA roles and states to its elements and keeps them up to date. It answers the keys that users of that kind of control expect, and it can mirror its layout for right-to-left languages. Charts, gauges and codes get a name that a screen reader can read out. Some things only your page knows: what a field is called, what a drawing shows, and what happened after a click. This guide shows what the widgets do in jQWidgets 27 (27.1.0) and the code your page adds for accessibility. The examples need no jQuery: `jqxcore.js` provides `$`. #### The conformance report The [jQWidgets Accessibility Conformance Report](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/compliance/vpat.htm) (VPAT 2.5 format) rates every WCAG 2.1 Level A and AA success criterion, says how each one was tested, and names the command that repeats the test. It is a self-issued report for version 27.0.0, dated 4 September 2026 and marked as a draft. | Question | What the report says | | --- | --- | | Which standard? | WCAG 2.1 Level A and AA. Of the 50 criteria, 37 are rated Supports and 13 Not Applicable, because they are about whole pages or media (page titles, captions and similar). | | What is covered? | `jqx.base.css` and the widgets that render HTML, in the `base`, `light` and `dark` themes. | | What is not covered? | The widgets that draw their content and take its colours from your options: jqxChart, jqxGauge, jqxLinearGauge, jqxBarGauge, jqxBulletChart, jqxHeatMap, jqxTreeMap, jqxKnob, jqxBarcode, jqxQRcode, jqxDraw and jqxGantt. The other themes, such as `fluent`, `tailwind` and `highcontrast`, are provided but not claimed. | | WCAG 2.2? | The six Level A and AA criteria that WCAG 2.2 adds are rated separately: 2.4.11 Focus Not Obscured is supported, 2.5.7 Dragging Movements and 2.5.8 Target Size are partially supported, and three do not apply. So the report does not claim WCAG 2.2 Level AA. | | Section 508, EN 301 549? | The report rates WCAG criteria only. It has no separate Section 508 or EN 301 549 tables. | Use the report for procurement and audits. The rest of this guide shows what it means for your page. #### WAI-ARIA roles and states Each widget adds its ARIA attributes when it is created; there is no option to turn on. This slider: ```html
``` renders this element (without its `class` and `style` attributes): ```html
``` `tabindex="0"` puts the slider in the Tab order. In the browser's accessibility tree, which is what a screen reader reads, it is a slider named "Volume" with values from 0 to 10. When the user presses the Right Arrow key, the widget changes `aria-valuenow` to 6. To see the same for any widget, inspect its element in the browser's developer tools, or open their Accessibility panel. The widgets follow the patterns of the [WAI-ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/). These are the roles and states that jQWidgets 27.1.0 renders for the widgets used most: | Widget | Roles | States and properties | | --- | --- | --- | | jqxSlider, jqxRating | `slider` | `aria-valuenow`, `aria-valuemin`, `aria-valuemax` | | jqxNumberInput | `spinbutton` | `aria-valuenow`, `aria-valuemin`, `aria-valuemax` | | jqxProgressBar | `progressbar` | `aria-valuenow` | | jqxCheckBox, jqxSwitchButton | `checkbox` | `aria-checked` | | jqxButtonGroup (radio mode) | `radiogroup`, `radio` | | jqxDropDownList, jqxComboBox | `combobox` | `aria-expanded`, `aria-haspopup`, `aria-owns`; an open jqxDropDownList names the highlighted item with `aria-activedescendant` | | jqxListBox | `listbox`, `option` | `aria-selected`, `aria-multiselectable` | | jqxTabs | `tablist`, `tab`, `tabpanel` | `aria-selected` and `aria-controls` on each tab, and only the selected tab in the Tab order; each tab panel is `aria-labelledby` its tab | | jqxTree | `tree`, `group`, `treeitem` | `aria-expanded` on an item with children; `aria-selected` on the selected item, which is also the tree's `aria-activedescendant` | | jqxMenu | `menubar`, `menuitem` | `aria-haspopup`, `aria-expanded` and `aria-owns` on an item with a submenu | | jqxGrid | `grid`, `row`, `columnheader`, `gridcell` | `aria-rowcount`, `aria-colcount`, `aria-rowindex`, `aria-colindex`, `aria-multiselectable`, `aria-sort` on a sorted column, and the selected row as `aria-activedescendant` | | jqxWindow | `dialog` | `aria-labelledby` its title bar, `aria-describedby` its content | | jqxInput | `textbox` | | jqxChart, the gauges, jqxBulletChart, jqxQRcode | `img` | `aria-label`: see Names for charts, gauges and codes | #### Turning the ARIA attributes off `$.jqx.ariaEnabled` is `true` by default. Setting it to `false` before you create any widget stops the widgets from writing their states: ```javascript $.jqx.ariaEnabled = false; ``` It does less than its name says. The roles, the labels and the grid's structure stay. What goes are the values and states, such as `aria-valuenow` and `aria-checked`, and the messages of `$.jqx.announce` (see Status messages). A slider is then a slider without a value, and axe-core reports it as an error (`aria-required-attr`). Leave the setting on. #### Keyboard navigation Tab moves into a widget and out of it again, and the arrow keys move inside it. The conformance report found every interactive widget operable from the keyboard, with no keyboard trap and a visible change when it gets the focus. These are the main keys in 27.1.0: | Widget | Keys | | --- | --- | | jqxSlider | Left and Down Arrow lower the value, Right and Up Arrow raise it; Home and End go to the minimum and the maximum | | jqxRating | Left and Right Arrow | | jqxNumberInput | Up and Down Arrow | | jqxCheckBox, jqxSwitchButton | Space | | jqxListBox | Up and Down Arrow, Home, End | | jqxDropDownList, jqxComboBox | Alt+Down Arrow opens the list, Down Arrow and Enter pick an item, Escape closes the list | | jqxDateTimeInput | Alt+Down Arrow opens the calendar; the arrow keys and Enter pick a day | | jqxCalendar | Left and Right Arrow: a day; Up and Down Arrow: a week; Page Up and Page Down: a month; Home and End: the first and last day of the month | | jqxTabs | Left and Right Arrow, Home, End | | jqxTree | Up and Down Arrow; Right Arrow expands an item and Left Arrow collapses it; Home, End | | jqxMenu | with `keyboardNavigation: true`: Left and Right Arrow, Alt+Down Arrow opens a submenu, Down Arrow and Enter choose in it, Escape closes it | | jqxGrid | Up and Down Arrow move the selection, Home and End go to the first and last row | | jqxButtonGroup | Left and Right Arrow move between the buttons | | jqxWindow | Escape closes it; a modal window keeps Tab inside it | | jqxTooltip | Escape closes it | What to know about a few widgets: - **jqxTree** and **jqxGrid** move from the selected item or row. When a tree gets the focus with nothing selected, it selects its first item; in a grid with no row selected, the first arrow key selects the first row. Before 27.1.0 the arrow keys did nothing until something was selected. On those versions, select an item or a row when you create the widget: `$('#tree').jqxTree('selectItem', document.querySelector('#tree li'))`, `$('#grid').jqxGrid('selectrow', 0)`. - **jqxMenu** answers the keyboard only with `keyboardNavigation: true`, which is `false` by default: `$('#menu').jqxMenu({ keyboardNavigation: true })`. - **jqxWindow**: when a modal window opens, the focus moves into it. Escape closes it, and the focus goes back to the element that had it before. The keyboard demos list all the keys of each widget: [Grid](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/keyboardsupport.htm), [Tree](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtree/keyboardsupport.htm), [ListBox](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxlistbox/keyboardsupport.htm), [DropDownList](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdropdownlist/keyboardsupport.htm), [ComboBox](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcombobox/keyboardsupport.htm), [Calendar](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcalendar/keyboardsupport.htm), [DateTimeInput](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatetimeinput/keyboardsupport.htm), [Slider](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxslider/keyboardsupport.htm), [Tabs](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtabs/keyboardsupport.htm), [Menu](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxmenu/keyboardnavigation.htm) and [Window](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxwindow/keyboardsupport.htm). #### Right-to-left languages 59 widgets have an `rtl` option. With `rtl: true`, a widget mirrors its layout for languages such as Arabic and Hebrew: the tabs start on the right, the grid's first column is on the right, and the arrow of a drop-down list moves to the left. ```javascript $('#tabs').jqxTabs({ rtl: true }); $('#country').jqxDropDownList({ rtl: true, source: ['Israel', 'Jordan'], width: 200, height: 32 }); ``` The option mirrors the widget only. It does not set the `dir` attribute, so give your page its language and direction as well; the widgets lay out the same way inside it: ```html ``` #### Contrast and the high-contrast theme The report measured the `base`, `light` and `dark` themes: no text below the contrast that WCAG 2.1 AA asks for, and control borders and focus indicators at 3:1 or more. If your application has to meet WCAG 2.1 AA, use one of these three. The `highcontrast` theme is for users with low vision. It shows black text on white, white on black under the pointer, and white on dark purple for the selected item: | State | Text on background | Contrast ratio | | --- | --- | --- | | Normal | `#000` on `#fff` | 21:1 | | Hover | `#fff` on `#000` | 21:1 | | Selected | `#fff` on `#37006e` | 15.13:1 | All three are above 7:1, the level of the WCAG AAA criterion 1.4.6 Contrast (Enhanced). On a test page with 16 widgets in this theme, axe-core found no text below 7:1. The theme is not part of the report's claim. To use it, load its stylesheet after `jqx.base.css` and set each widget's `theme`: ```html ``` The `highcontrast` theme does not change chart colours. For colour-blind users, the report measured the 27 colour schemes of version 27.0.0: only `scheme09` kept every pair of series apart for all three common kinds of colour blindness. 27.1.0 adds `scheme28` and makes it the default; measured the same way, it keeps every pair apart too. #### Names for charts, gauges and codes Widgets that draw get `role="img"` and an `aria-label`, so a screen reader reads each one as a single image with a name: | Widget | Name | Example | | --- | --- | --- | | jqxChart | its title and description | "Sales. Units by month" | | jqxGauge, jqxLinearGauge | the reading | "Gauge, 55 of 0 to 220" | | jqxBarGauge | the values | "Bar gauge, values 35, 60, 80" | | jqxBulletChart | its title and description | "Revenue. (U.S. $ thousands)" | | jqxQRcode | the encoded value | "https://www.jqwidgets.com" | A chart with no title and no description gets no role at all, rather than an image without a name. An `aria-label` that you put on the element wins over the widget's own name. Use it to say what the chart shows, not only what it is called: ```html
``` A gauge's own name follows its value. An `aria-label` that you set wins, and the widget does not change it, so if you name a gauge yourself, change the name with the value: ```javascript function setTemperature(value) { $('#gauge').jqxGauge('value', value); $('#gauge').attr('aria-label', 'Engine temperature, ' + value + ' degrees'); } ``` jqxDraw is a drawing surface, and it cannot know what you draw on it. Give its element the role and the name yourself: ```html ``` #### Status messages A screen reader reads what has the focus. Changes elsewhere on the page, such as a sorted grid or a saved form, stay silent unless they go into a live region. When the page has loaded, `jqxcore.js` adds two hidden live regions to it: `#jqxLiveRegionPolite` (`role="status"`) and `#jqxLiveRegionAssertive` (`role="alert"`). The grid uses them: sorting by the Product column announces "Sorted by Product". Your code can use them too, with `$.jqx.announce`. A message is polite by default, so the screen reader waits until it has finished speaking. Pass `true` for an error, which is read at once: ```javascript $.jqx.announce('3 rows saved'); $.jqx.announce('Could not save the changes', true); ``` Announce the changes that your own code makes. For example, when your code selects a grid row while the focus is somewhere else, the report notes that nothing is announced. #### What your page adds ##### A name for every field A widget cannot know what a field is for. Give each one a visible label and connect the two; how depends on the widget: | Widget | How to name it | | --- | --- | | jqxCheckBox | Its text: `
Gift wrap
` | | jqxSlider, jqxSwitchButton, jqxListBox, jqxTree, jqxGrid, jqxDropDownList, jqxInput | `aria-label` or `aria-labelledby` on the widget's element. jqxInput also takes a `
``` The script is a module (` ``` #### 2Add a container and create the chat Add a host element, then initialize it in a `$(document).ready` handler. ```html
``` #### 3Connect an AI provider Pick a provider with `provider` (`'anthropic'`, `'openai'` or `'custom'`) and a `model`, then choose one of three ways to authenticate. ##### a) Quick trial - apiKey Fastest to try. The key is used from the browser, so use this for local development only. ```javascript $('#chat').jqxChat({ provider: 'anthropic', model: 'claude-opus-4-8', apiKey: 'YOUR_KEY' // dev only - never ship a key to the browser }); ``` ##### b) Production - proxyUrl Point the chat at your own endpoint. Your server holds the key and forwards the request to the provider. ```javascript $('#chat').jqxChat({ provider: 'anthropic', proxyUrl: '/api/chat' }); ``` ##### c) Full control / offline - sendRequest Provide your own transport. It receives the conversation `payload` and returns a `Promise` that resolves to the assistant's text (or you stream tokens with `chat.appendDelta()`). ```javascript $('#chat').jqxChat({ sendRequest: function (payload, chat) { // payload = { messages: [{ role, content }], system, model, ... } return fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }).then(function (r) { return r.text(); }); } }); ``` #### 4Streaming responses Set `stream: true` to render tokens as they arrive (Server-Sent Events with the built-in providers). With a custom `sendRequest`, call `chat.appendDelta(token)` for each chunk instead of resolving the whole string at once. ```javascript $('#chat').jqxChat({ provider: 'anthropic', proxyUrl: '/api/chat', stream: true }); ``` #### 5Common options | Option | Type | Description | | --- | --- | --- | | `title` / `subtitle` | string | Header text. | | `welcomeMessage` | string | First assistant bubble shown before any input (Markdown supported). | | `starterPrompts` | string[] | Suggestion chips the user can tap to start. | | `colorScheme` | string | `'light'`, `'dark'` or `'auto'`. | | `accentColor` | string | Any CSS color for the send button, user bubbles, avatars and launcher. | | `mode` | string | `'inline'` (embedded) or `'popup'` (floating launcher). | | `launcherPosition` | string | Popup launcher corner, e.g. `'bottom-right'`. | | `botName` / `botAvatar` / `userAvatar` | string | Branding - names and avatar image URLs or data-URIs. | | `system` | string | System prompt sent with every request. | | `maxTokens` | number | Response length cap. | | `stream` | boolean | Stream tokens as they arrive. | See the full list in the [jqxChat API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-chat-api.htm). #### 6Popup (floating) mode Render a floating launcher button that opens the chat panel - great for a site-wide help assistant. ```javascript $('#chat').jqxChat({ mode: 'popup', launcherPosition: 'bottom-right', title: 'Help Assistant' }); ``` #### 7Methods Call methods with the standard jQWidgets syntax: `$('#chat').jqxChat('methodName', args)`. | Method | Description | | --- | --- | | `sendMessage(text)` | Send a user message programmatically. | | `addMessage(role, content)` | Append a message (`'user'` or `'assistant'`) without calling the model. | | `appendDelta(delta)` | Append a streaming token to the current assistant message. | | `getMessages()` | Return the conversation array. | | `clearConversation()` | Reset the conversation. | | `stop()` | Stop an in-flight response. | | `openPopup()` / `closePopup()` / `toggle()` | Control the popup panel (popup mode). | | `focus()`, `val()`, `refresh()`, `destroy()` | Focus the input, get/set the input text, re-render, or tear down. | ```javascript $('#chat').jqxChat('sendMessage', 'Summarize this page'); ``` #### 8Events Bind with `$('#chat').on('eventName', handler)`; the payload is on `event.args`. | Event | Fires when | | --- | --- | | `messageSent` | The user sends a message. | | `responseStart` | The assistant response begins. | | `responseDelta` | A streaming token arrives. | | `messageReceived` | A complete assistant message is added. | | `responseEnd` | The response finishes. | | `error` | A request fails. | | `open` / `close` | The popup panel opens or closes. | | `stop` | A response is stopped. | | `create` | The widget is initialized. | ```javascript $('#chat').on('messageReceived', function (event) { const message = event.args; // { role: 'assistant', content: '...' } }); ``` #### 9Theming The chat follows the active jQWidgets theme. Beyond that, set `colorScheme` and `accentColor` - at init or at runtime - to match your brand. No extra theme files required. ```javascript // at runtime $('#chat').jqxChat({ colorScheme: 'dark', accentColor: '#ec4899' }); ``` #### 10Frameworks The same component ships as native wrappers - the options, methods and events map 1:1. ```javascript // Angular import { jqxChatModule } from 'jqwidgets-ng/jqxchat'; ``` React and Vue wrappers follow the same pattern (`jqxChat` component with matching props/events). **Next steps:** browse the full [jqxChat API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-chat-api.htm) for every property, method and event, and explore the demos for branding, popup mode, themes, and events & methods. --- ### jQWidgets MCP Server Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/mcp/mcp-server.htm > A Model Context Protocol server that gives AI coding assistants full knowledge of the jQWidgets component library — 80+ widgets with every property, method… A Model Context Protocol server that gives AI coding assistants full knowledge of the jQWidgets component library — 80+ widgets with every property, method, event and data type, plus a code generator that emits runnable examples for jQuery, React, Angular and Vue. #### What it does Wire the server into any MCP-aware assistant and ask in plain English. The assistant can: - Answer API questions — *"what properties does `jqxGrid` support?"*, *"what events does `jqxScheduler` fire?"* - Resolve the exact `

``` - `aiSendRequest` is called with `{ system, user }` and returns the model's text. No key is in the page. - `$('#grid').jqxGrid('aiCommand', text)` returns a Promise. The example uses the other form: a Node-style callback `(error, result)` as the last argument. - `result.applied` lists the actions as text. Show it, so the user sees what the grid did with the request. - The grid applies filters, a sort and groups only when `filterable`, `sortable` and `groupable` allow them, and their scripts are loaded. Click **Apply**. The model returns a filter on Country, a filter on Amount and a sort, and the grid shows the two German orders over 1,000, largest first: "Applied: Country EQUAL Germany, Amount GREATER_THAN 1000, sort by Amount desc". Try "group by country" or "customers starting with A". #### 3. The Scheduler The same endpoint answers questions about a schedule. This page asks with `aiAsk` and shows the answer. ```html jqxScheduler AI assistant

``` A question such as "What is booked on Friday?" goes to the model with the appointments, and the answer appears above the scheduler. The other methods are called the same way: - `aiScheduleAppointment(text)` adds an appointment described in words, after it checks the subject and the times. - `aiFindSlot(text)` resolves with `{ slots }`: free times computed from the real appointments. `aiBookSlot(slot, { subject })` books one of them. - `aiResolveConflicts()` finds double bookings and proposes new times, without a model. `aiApplyResolution(proposals)` moves them, as one step for `undo()`. Changes go through `addAppointment` and the scheduler's change events, so an `appointmentAdding` or `appointmentChanging` handler can still cancel them. #### 4. The Gantt jqxGantt is created with `new jqxGantt(selector, options)`, and its methods are called on that object. Its `aiCommand` changes task dates and progress and links tasks. ```html jqxGantt AI commands

``` "Mark Design as done" comes back as an edit of the task `design` with progress 100. The Gantt applies an edit only to a task whose id or label matches exactly one task, keeps progress between 0 and 100, and ignores an end date before the start. "Applied: "Design" progress=100" is shown above the chart. #### Methods Every AI method returns a Promise, except `aiConfig`, `aiBookSlot` and `aiApplyResolution`. The methods that return a Promise also take an optional Node-style callback `(error, result)` as their last argument. | Method | What it does | Result | | --- | --- | --- | | **jqxGrid** | | `aiCommand(text)` | Turns a request into filters, a sort and groups, checks them against the columns and operators, and applies them. The model can also ask to clear the current filters and groups first. | `{ spec, applied, query }`: the model's JSON, the applied actions as text, the request | | `aiAsk(text)` | Answers a question from the columns, the totals of the number columns and up to `aiMaxRows` rows. | `{ answer, chart, query }`; `chart` is a suggested chart (`{ type, categoryField, valueField, aggregate }`) or `null` | | `aiSummarize(rows?)` | Summarizes the rows you pass, or else the selected rows, or else up to `aiMaxRows` rows. | `{ summary, count }` | | `aiExplainRow(rowindex)` | Explains how one row compares with the rest of the data. | `{ row, explanation }` | | `aiClassifyColumn({ datafield, instruction, categories?, sourceFields? })` | Asks for one label per row and writes it into the existing column `datafield` with `setcellvalue`. | `{ datafield, written }` | | **jqxScheduler** | | `aiCommand(text)` | Shows only the appointments that match filters on subject, location, description, resource and status, and a date range. Resources and statuses must be ones the scheduler knows. | `{ spec, applied, query }` | | `aiScheduleAppointment(text)` | Adds one appointment. It needs a subject and an end after the start. | `{ appointment, query }` | | `aiAsk(text)` | Answers a question about the appointments. | `{ answer, query }` | | `aiSummarize()` | Summarizes the selected appointment, or else up to `aiMaxRows` visible appointments. | `{ summary, count }` | | `aiExplainAppointment(key)` | Explains how one appointment fits the schedule. | `{ key, explanation }` | | `aiClassifyAppointments({ datafield, instruction?, categories? })` | Writes a label into a property of your own (not a built-in field such as `subject`) of each appointment. | `{ datafield, written }` | | `aiFindSlot(text)` | Reads the duration, resource, time window and working hours from the request, then computes free times. | `{ slots, query, request, subject }`; each slot is `{ from, to, resourceId }` | | `aiBookSlot(slot, details?)` | Adds an appointment in a slot from `aiFindSlot`. Throws when an `appointmentAdding` handler cancels it. | the appointment | | `aiResolveConflicts(options?)` | Finds overlapping appointments of the same resource and proposes the next free time for the later one. No model is called. | `{ conflicts, proposals }` | | `aiApplyResolution(proposals)` | Moves the appointments as proposed, as one undo step. | the number moved | | **jqxGantt** | | `aiCommand(text)` | Changes start and end dates and progress, and adds connections, for tasks named by id or label. | `{ spec, applied, query }` | | `aiAddTask(text)` | Inserts a task, a project or a milestone, optionally inside an existing project. | `{ task, query }` | | `aiAsk(text)` | Answers a question about the plan. | `{ answer, query }` | | `aiSummarize()` | Summarizes progress, dates and overdue tasks. | `{ summary, count }` | | `aiExplainTask(ref)` | Explains one task with its connections. | `{ ref, explanation }` | | `aiClassifyTasks({ datafield, instruction?, categories? })` | Writes a label into a field of your own on each task. Read it back with `aiGetCustomField(ref, field)`. | `{ datafield, written }` | | **All three** | | `aiConfig(options)` | Sets or changes the AI configuration while the page runs. | the configuration | #### Options Set them with the other widget options, or later with `aiConfig({... })`, which takes the keys in the second column: `$('#grid').jqxGrid('aiConfig', { maxRows: 20 })`. | Option | `aiConfig` key | Meaning | | --- | --- | --- | | `aiSendRequest` | `sendRequest` | `async ({ system, user, model, provider }) => string`. Your own transport. When it is set, the options below that describe a provider are not used. | | `aiProxyUrl` | `proxyUrl` | Your endpoint. The widget posts the provider's request body there (Anthropic or OpenAI format, by `aiProvider`) and reads the provider's response. | | `aiProvider` | `provider` | `'anthropic'` (default), `'openai'` or `'custom'` (the Anthropic format) | | `aiKey` | `apiKey` | The provider's API key, for a trial on your own machine only: it is visible to anyone who opens the page. | | `aiModel` | `model` | The model name. Without it, the widget uses `claude-opus-4-8` (Anthropic) or `gpt-4o` (OpenAI). | | `aiHeaders` | `headers` | Extra request headers, for example your session token for `aiProxyUrl` | | `aiMaxRows` | `maxRows` | How many rows, appointments or tasks are sent as context (default 40) | The grid also has `aiUrl`, an older name for `aiProxyUrl`. #### Events Each widget raises an event when an AI method has finished, and another when a request fails. The result is `{ type, result }`, where `type` names the method (`'command'`, `'ask'`, `'summary'` and so on). An error is `{ error, message }`. | Widget | Events | Where the data is | | --- | --- | --- | | jqxGrid | `gridaiResult`, `gridaiError` | the handler's second argument: `$('#grid').on('gridaiResult', (event, data) => {... })` | | jqxScheduler | `scheduleraiResult`, `scheduleraiError` | `event.args`, as in the scheduler's other events | | jqxGantt | `ganttaiResult`, `ganttaiError` | the handler's second argument, as for the grid | #### jqxChat: a chat panel for your assistant jqxChat is a chat interface, inline or as a floating button, with streamed replies and your own branding. It connects in the same way: `provider` and `apiKey` for a trial, `proxyUrl` or `sendRequest` to go through your server. Its `sendRequest` receives the whole conversation in the provider's request format. See [Chat getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchat/jqxchat-getting-started.htm). #### In your editor: the MCP server The features above are for your users. For you, the [jQWidgets MCP server](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/mcp/mcp-server.htm) gives AI coding assistants (Claude Code, Cursor, GitHub Copilot) the API of every widget, the scripts each one needs, and working examples. #### Demos and API reference - Grid demos: [AI command bar](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/ai-command-bar.htm), [Ask the data](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/ai-ask-data.htm), [Summarize](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/ai-summarize.htm), [Classify a column](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/ai-classify-column.htm) - Scheduler demos: [AI assistant](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxscheduler/ai-assistant.htm), [Smart scheduling](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxscheduler/ai-smart-scheduling.htm) - Chat demos: [jqxChat](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchat/index.htm) - Grid API: [aiSendRequest](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm#aiSendRequest), [aiCommand](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm#aiCommand), [aiAsk](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm#aiAsk), [aiClassifyColumn](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm#aiClassifyColumn), [gridaiResult](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm#gridaiResult) - Scheduler API: [aiConfig](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxscheduler/jquery-scheduler-api.htm#aiConfig), [aiAsk](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxscheduler/jquery-scheduler-api.htm#aiAsk), [aiFindSlot](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxscheduler/jquery-scheduler-api.htm#aiFindSlot), [scheduleraiResult](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxscheduler/jquery-scheduler-api.htm#scheduleraiResult) - Gantt: [Getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgantt/gantt-getting-started.htm) and [API](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgantt/gantt-api.htm) The demos use an offline mock in place of the model, so they run without a key. Next: [Grid getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-getting-started.htm). ## Components --- ### Using jQWidgets in a Blazor Web App Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/asp-net-blazor/asp-net-blazor.htm > This tutorial adds a sortable, pageable jqxGrid to a Blazor Web App on .NET 10. This tutorial adds a sortable, pageable jqxGrid to a Blazor Web App on.NET 10. The grid is the jQWidgets JavaScript component, driven from a Razor component through JavaScript interop: C# passes the rows to the grid, and the grid reports the selected row back to C#. This page used to show a Blazor Server app on.NET Core 3.0, with the scripts in `_Host.cshtml` and a global `createComponent` function..NET 8 replaced that template with the Blazor Web App, which has no `_Host.cshtml`, and JavaScript is now loaded as a module that sits next to the component. The steps below use the current template and APIs. Looking for native Blazor components written in C#? See [Smart.Blazor](https://www.htmlelements.com/blazor/). The approach on this page lets you use any jQWidgets widget in a Blazor app. #### 1. Prerequisites - The.NET 10 SDK..NET 8 and 9 work the same way; only the target framework in the project file changes. - Node.js 22 or later. It is used only to download the jQWidgets files with npm. #### 2. Create the project `--interactivity Server` makes the components interactive over a SignalR connection, which is what Blazor Server used to be. JavaScript interop needs an interactive component: a statically rendered page never runs `OnAfterRenderAsync`. ```bash dotnet new blazor -n WebApp --interactivity Server cd WebApp ``` #### 3. Add jQWidgets to wwwroot Blazor serves static files from `wwwroot`, so copy the `jqwidgets` folder of the `jqwidgets-scripts` package there. The folder holds the scripts and the `styles` folder with the theme images and fonts. jQuery is not required: `jqxcore.js` brings its own jQuery-compatible core and defines `$`. ```bash npm init -y npm install jqwidgets-scripts@27 mkdir -p wwwroot/lib cp -r node_modules/jqwidgets-scripts/jqwidgets wwwroot/lib/jqwidgets ``` Add `node_modules` to `.gitignore`. If you prefer not to host the files, load them from the jsDelivr CDN instead, for example `https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/jqwidgets/jqx-all.js`. #### 4. Load the scripts and styles Open `Components/App.razor`, the page that hosts every component. Add the two stylesheets to ``: ```html ``` Add the script at the end of ``, before the `blazor.web.js` script tag, so the widgets are defined before any component runs: ```html ``` `jqx-all.js` contains every widget. In production you can load only the files the app needs, such as `jqxcore.js`, `jqxdata.js`, `jqxbuttons.js`, `jqxscrollbar.js`, `jqxmenu.js`, `jqxlistbox.js`, `jqxdropdownlist.js` and the `jqxgrid*.js` modules. #### 5. Add the JavaScript module Create `Components/Pages/Home.razor.js` next to the page. A `.razor.js` file is a collocated module: Blazor publishes it with the app, and the component imports it when it needs it, so nothing is global. ```javascript // Grids created by this module, by the container element Blazor gave us. const grids = new WeakMap(); export function createGrid(container, employees, dotnet) { // The grid gets its own element inside the container: Blazor owns the container // and must not find it changed when it updates the page. const host = document.createElement('div'); container.appendChild(host); grids.set(container, host); const source = { localdata: employees, datatype: 'array', datafields: [ { name: 'id', type: 'number' }, { name: 'firstName', type: 'string' }, { name: 'lastName', type: 'string' }, { name: 'title', type: 'string' }, { name: 'hireDate', type: 'date' } ] }; $(host).jqxGrid({ width: '100%', autoheight: true, theme: 'material', source: new jqx.dataAdapter(source), sortable: true, pageable: true, columns: [ { text: 'First Name', datafield: 'firstName', width: 160 }, { text: 'Last Name', datafield: 'lastName', width: 160 }, { text: 'Title', datafield: 'title' }, { text: 'Hire Date', datafield: 'hireDate', cellsformat: 'd', width: 140 } ] }); // rowindex is the row's place on screen, which changes when the grid is sorted: // send the row's id instead. $(host).on('rowselect', function (event) { const row = $(host).jqxGrid('getrowdata', event.args.rowindex); if (row) { dotnet.invokeMethodAsync('OnRowSelected', row.id); } }); } export function destroyGrid(container) { const host = grids.get(container); if (host) { $(host).jqxGrid('destroy'); grids.delete(container); } } ``` #### 6. Create the grid from the component Replace `Components/Pages/Home.razor`. The component imports the module after its first render, when the container element exists, and passes it the rows. Blazor serializes the C# records to JSON with camel-case names, so `FirstName` arrives as `firstName`. `DotNetObjectReference` lets the module call `OnRowSelected` back. ```csharp @page "/" @rendermode InteractiveServer @implements IAsyncDisposable @inject IJSRuntime JS Employees

Employees

@(selected is null ? "Select a row." : $"Selected: {selected.FirstName} {selected.LastName}, {selected.Title}")

@code { private ElementReference gridContainer; private IJSObjectReference? module; private DotNetObjectReference? self; private Employee? selected; private readonly List employees = [ new(1, "Nancy", "Davolio", "Sales Representative", new DateOnly(2019, 5, 1)), new(2, "Andrew", "Fuller", "Vice President, Sales", new DateOnly(2018, 8, 14)), new(3, "Janet", "Leverling", "Sales Representative", new DateOnly(2020, 4, 1)), new(4, "Margaret", "Peacock", "Sales Representative", new DateOnly(2021, 5, 3)), new(5, "Steven", "Buchanan", "Sales Manager", new DateOnly(2021, 10, 17)), new(6, "Michael", "Suyama", "Sales Representative", new DateOnly(2022, 10, 17)), new(7, "Robert", "King", "Sales Representative", new DateOnly(2023, 1, 2)), new(8, "Laura", "Callahan", "Inside Sales Coordinator", new DateOnly(2024, 3, 5)), new(9, "Anne", "Dodsworth", "Sales Representative", new DateOnly(2025, 11, 15)) ]; protected override async Task OnAfterRenderAsync(bool firstRender) { if (!firstRender) { return; } module = await JS.InvokeAsync("import", "./Components/Pages/Home.razor.js"); self = DotNetObjectReference.Create(this); await module.InvokeVoidAsync("createGrid", gridContainer, employees, self); } [JSInvokable] public void OnRowSelected(int id) { selected = employees.Find(e => e.Id == id); StateHasChanged(); } public async ValueTask DisposeAsync() { if (module is not null) { try { await module.InvokeVoidAsync("destroyGrid", gridContainer); await module.DisposeAsync(); } catch (JSDisconnectedException) { // The browser has gone (the tab was closed); there is nothing to clean up. } } self?.Dispose(); } public record Employee(int Id, string FirstName, string LastName, string Title, DateOnly HireDate); } ``` `DisposeAsync` runs when the reader navigates to another page. It destroys the grid, so its event handlers and popups do not outlive the component, and releases the module and the object reference. #### 7. Run the app ```bash dotnet watch ``` Open the address that `dotnet watch` prints. You should see the employees in a grid you can sort and page. Click a row, and the text under the grid shows the employee, set by C#. #### Calling the grid from C To call a grid method from C#, export a function for it from the module and invoke it. For example, add this to `Home.razor.js`: ```javascript export function clearSelection(container) { $(container.firstElementChild).jqxGrid('clearselection'); } ``` and call it from the component: ```csharp await module!.InvokeVoidAsync("clearSelection", gridContainer); ``` #### Blazor WebAssembly The same component and module work with `--interactivity WebAssembly` or `Auto`. Put `Home.razor` and `Home.razor.js` in the client project, and import the module by its path in that project, such as `./Pages/Home.razor.js`. The scripts and styles stay in the server project's `App.razor` and `wwwroot`. #### Next steps - [Grid getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-getting-started.htm) and the [Grid API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm). - [Server-side paging with ASP.NET Core](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/asp.net-integration/asp.net-grid-paging.htm), for tables too large to send to the browser at once. - The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/) of every widget. --- ### jQuery BarGauge Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbargauge/jquery-bar-gauge-getting-started.htm > jQuery BarGauge getting started: install jQWidgets, add jqxBarGauge to your app, see a complete example, then handle its events and call its methods. jqxBarGauge represents a jQuery bargauge widget that enables the user to select a date using a visual monthly bargauge display. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `3` scripts, listed below - **Demos:** [jQuery BarGauge demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbargauge/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbargauge/jquery-bar-gauge-api.htm) jqxBarGauge in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbargauge/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the BarGauge's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#barGauge').jqxBarGauge({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbargauge/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxBarGauge widget requires the following files: ```html ``` The next step is to create html element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```javascript $(document).ready(function() { // jqxBarGauge initialization code goes here. } ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxBarGauge’s constructor. ```html $("#jqxGauge").jqxGauge('val', [14, 27, 35]); ``` To get the result of a function after calling it, you can use the following syntax: ```html var values = $("#jqxbargauge'").jqxBarGauge(‘val’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxBarGauge's constructor. ```html $("#jqxbargauge").jqxBarGauge({ backgroundColor: 'red' }); ``` To get a property(option), you need to pass the property name to the jqxBarGauge's constructor. ```html const backgroundColor = $("#jqxbargauge").jqxBarGauge('backgroundColor'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the selected date after the user clicks on a cell. The example code below demonstrates how to bind to the ‘valuechanged’ event of jqxBarGauge. ```html $('#jqxbargauge').on('valueChanged', function (event) { }); ``` #### Basic Sample ```html jqxBarGauge displays an indicator within a range of values. Gauges can be used in a table or matrix to show the relative value of a field in a range of values in the data region.
``` --- ### jQuery BarGauge Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbargauge/jquery-bar-gauge-styling-and-appearance.htm > Style the jQuery BarGauge: the jqxBarGauge CSS classes, the theme stylesheets it uses and how to change its appearance. To set the jqxBarGauge's size, you need to use the 'width' and 'height' properties. These properties accept number values and percentage values. jqxBarGauge offers many options to customize the BarGauge appearance. In this section we will go through the styling options available in different BarGauge elements. jQWidgets uses a CSS file - jqx.base.css. The base stylesheet creates the styles related to the widget's layout. #### Series Color Scheme jqxBarGauge ships with eleven built-in color schemes which are used to automatically set colors for different series. You can change the color scheme by setting the colorScheme option of the BarGauge. - The available values are from 'scheme01' to 'scheme27'. - Another option is combination of "colorScheme" with "customColorScheme" property - code example: ```javascript $('#barGauge').jqxBarGauge({ colorScheme: 'customColors', customColorScheme: { name: 'customColors', colors: ["#FFCF5E", "#E83C64", "#50C7E3", "#50ADFF", "#7478FF"] } }); ``` - name - sets the name of color scheme that corresponding with set value of "colorScheme" property. - colors - sets the array of colors. #### Below is the list of CSS classes used by jqxBarGauge. - jqxBarGauge Style - jqx-bar-gauge-tooltip - applied to jqxBarGauge's tooltip. To control container of the tooltip. ##### Title and subtitle To change position of the title, you need to set 'verticalAlignment' property and/or 'horizontalAlignment' property of the title. ```javascript $('#barGauge').jqxBarGauge({ values: [10, 55, 80], title: { text: 'jqxBarGauge', horizontalAlignment: 'left', verticalAlignment: 'bottom', subtitle: { text: '( default demo )', } }, }); ``` If need to make fine correction of the position of the title, can set 'margin' property of the title. It can also be set and 'font' (for both - title and subtitle) with standard members - 'color', 'family', 'opacity', 'size' and 'weight'. - color - sets the color of the text. - family - sets the font family of the text. - opacity - sets the font opacity of the text. - size - sets the size of the text. - weight - sets the font weight of the text. ```javascript $('#barGauge').jqxBarGauge({ title: { margin: { bottom: 0, left: 0, right: 0, top: 0, }, font: { color: '#232323', family: "'Segoe UI', 'Helvetica Neue', 'Trebuchet MS', Verdana", opacity: 0.7, size: 16, weight: 200 }, subtitle: { text: 'demo', font: { color: '#1C2C3C', family: "'Segoe UI', 'Helvetica Neue', 'Trebuchet MS', Verdana", opacity: 1, size: 16, weight: 200 } } }, }); ``` ##### Relative inner radius To change inner radius of the BarGauge, you need to set 'relativeInnerRadius' property. It describe the ratio between the two radiuses. From zero to one. ```javascript $('#barGauge').jqxBarGauge({ values: [10, 55, 80], relativeInnerRadius: 0.7 }); ``` ##### Geometry To determine the geometry of the BarGauge, you need to set 'geometry' property. With those options 'startAngle' and 'endAngle'. These properties accept number values that describe angles in degrees. ```javascript $('#barGauge').jqxBarGauge({ values: [90, 35, 50, 14], geometry: { startAngle: 130, endAngle: -10 }, }); ``` ##### Segments To make fine settings to represent values with different sizes. To determine the segments of the BarGauge, you need to set 'min' property and/or 'max' property. ```javascript $('#barGauge').jqxBarGauge({ values: [119, 135, 140, 114, 111], startValue: 110, endValue: 140, }); ``` To represent value with mixed values positive and negative of the BarGauge, you need to set 'min' property with some negative value. ```javascript $('#barGauge').jqxBarGauge({ min: -30 }); ``` To change base value of the BarGauge, you need to set 'baseValue' property. ```javascript $('#barGauge').jqxBarGauge({ baseValue: 25 }); ``` To change space between the segments in the BarGauge, you need to set 'barSpacing' property. ##### Animation To set the animations of the BarGauge, you need to set 'animationDuration' property. Determine time of the animation. In milliseconds (1000 ms = 1 sec). If you don;t wat the widget to be animated - set 'animationDuration' to 0. ```javascript $('#barGauge').jqxBarGauge({ animationDuration: 500 }); ``` --- ### jQuery BarGauge API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbargauge/jquery-bar-gauge-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxbargauge.txt #### Properties - `animationDuration` (Type: Number, Default: 1000): Determines the animation in milliseconds. To disable this property - set it to **0** (zero). - `backgroundColor` (Type: String, Default: '#e0e0e0'): Sets or gets the jqxBarGauge background color. - `barSpacing` (Type: Number, Default: 4): Sets or gets the space between the segments of the jqxBarGauge. - `baseValue` (Type: Number, Default: null): Sets the base value of jqxBarGauge. - `colorScheme` (Type: String, Default: 'scheme01'): Sets the jqxBarGauge's color palette. jqxBarGauge supports 27 color schemes from 'scheme01' to 'scheme27'. I's possible to set custom scheme in combination with "customColorScheme" property. - `customColorScheme` (Type: String, Default: 'scheme01'): Sets custom color palette in the BarGauge. This is used in combination with "colorScheme" property. - `disabled` (Type: Boolean, Default: false): Sets or gets the values of the disabled property of jqxBarGauge. By default is false. - `endAngle` (Type: Number, Default: 0): Sets or gets the endAngle of the BarGauge. Used to create geometry of the arc in the space. - `formatFunction` (Type: Object, Default: null): Sets or gets the formatFunction of the BarGauge. Used to make changes on the particular segment. - `height` (Type: Number, Default: 400): Sets or gets the BarGauge's height. - `labels` (Type: Object, Default: null): This property is used to make fine settings on BarGauge labels at each segment. - `max` (Type: Number, Default: 100): Sets or gets the end value of BarGauge. - `min` (Type: Number, Default: 0): Sets or gets BarGauge's min. This property specifies the beginning of the BarGauge's scale. - `relativeInnerRadius` (Type: Number, Default: 0.3): Sets or gets the relativeInnerRadius of jqxBarGauge. It's value represents the proportion between inner and outer radius. - `rendered` (Type: Function, Default: null): This function is called when the BarGauge is initialized and the binding is complete. - `startAngle` (Type: Number, Default: 225): Sets or gets the startAngle of the BarGauge. Used to create geometry of the arc in the space. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `title` (Type: Object|String, Default: null): Sets or gets the BarGauge's title. This property can be string or object with custom title settings. - `tooltip` (Type: Object, Default: null): Sets or gets the BarGauge's tooltip. - `useGradient` (Type: Boolean, Default: true): Sets or gets useGradient of the BarGauge. Change visualization of the segments between flat color or with gradient. - `values` (Type: Array, Default: []): Sets or gets array of values for the BarGauge. - `width` (Type: Number, Default: 400): Sets or gets the BarGauge's width. #### Events - `drawEnd` (Type: Event): The event is raised when the BarGauge finish rendering. Commonly used in combination with drawStart event. - `drawStart` (Type: Event): The event is raised when the BarGauge starts rendering again. Commonly used in combination with drawEnd event. - `initialized` (Type: Event): Fires when the jqxBarGauge is rendered for the first time. The BarGauge is initialized. - `tooltipClose` (Type: Event): Fires when a BarGauge's tooltip is closed. - `tooltipOpen` (Type: Event): Fires when a BarGauge's tooltip is open. - `valueChanged` (Type: Event): Fires after the values are changed. #### Methods - `refresh` (Type: Method): Refreshes the BarGauge. - `render` (Type: Method): Renders the BarGauge contents. This method completely refreshes the BarGauge. - `val` (Type: Method): Returns an array of the BarGauge values. --- ### jQuery BulletChart Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbulletchart/jquery-bullet-chart-getting-started.htm > jQuery BulletChart getting started: install jQWidgets, add jqxBulletChart to your app, see a complete example, then handle its events and call its methods. jqxBulletChart represents a JavaScript component which features two measures - a primary one (the pointer) and a comparative one (the target) and displays them in the context of a number of differently styled qualitative ranges. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `4` scripts, listed below - **Demos:** [jQuery BulletChart demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbulletchart/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbulletchart/jquery-bullet-chart-api.htm) jqxBulletChart in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbulletchart/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the BulletChart's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#bulletChart').jqxBulletChart({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbulletchart/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxBulletChart widget requires the following files: ```html ``` *Note that jqxtooltip.js is required only if you wish the bullet chart's tooltip to be enabled.* The next step is to create a DIV element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxBulletChart’s constructor. ```javascript $("#jqxBulletChart").jqxBulletChart("val", 50); ``` To get the result of a function(method) call, you need to pass the method name in the jqxBulletChart’s constructor and parameters(if any). ```javascript const value = $("#jqxBulletChart").jqxBulletChart("val"); ``` To set a property(option), you need to pass the property name and value(s) in the jqxBulletChart's constructor. ```javascript $("#jqxBulletChart").jqxBulletChart({ disabled: true }); ``` To get a property(option), you need to pass the property name to the jqxBulletChart's constructor. ```javascript const height = $("#jqxBulletChart").jqxBulletChart("disabled"); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. The example code below demonstrates how to bind to the "change" event of jqxBulletChart. ```javascript // bind to change event. $("#jqxBulletChart").on("change", function (event) { alert("Value changed"); }); ``` #### Basic Sample ```html jQuery BulletChart Sample
``` --- ### jQuery BulletChart Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbulletchart/jquery-bullet-chart-styling-and-appearance.htm > Style the jQuery BulletChart: the jqxBulletChart CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxBulletChart. - jqx-widget - applied to the jqxBulletChart widget. - jqx-bulletchart - applied to the jqxBulletChart. - jqx-bulletchart-title - applied to the jqxBulletChart title. - jqx-bulletchart-description - applied to the jqxBulletChart description. - jqx-bulletchart-range - applied to the jqxBulletChart ranges. - jqx-bulletchart-pointer - applied to the jqxBulletChart pointer. - jqx-bulletchart-target - applied to the jqxBulletChart target. - jqx-bulletchart-ticks - applied to the jqxBulletChart ticks. - jqx-bulletchart-zero-tick - applied to the jqxBulletChart zero tick (shown only when the minimum value is a negative number). - jqx-bulletchart-labels - applied to the jqxBulletChart labels. - jqx-fill-state-pressed - applied to the pointer and target if their **color** properties are not set or are set to *""*. - jqx-fill-state-hover - applied to a hovered pointer or target if its **color** property is not set or is set to *""*. - jqx-fill-state-disabled - applied to the jqxBulletChart when it is disabled. Classes applied only when the **orientation** property is set to *"horizontal"*: - jqx-bulletchart-range-horizontal - applied to ranges. - jqx-bulletchart-target-horizontal - applied to the target. - jqx-bulletchart-ticks-horizontal - applied to ticks. Classes applied only when the **orientation** property is set to *"vertical"*: - jqx-bulletchart-range-vertical - applied to ranges. - jqx-bulletchart-target-vertical - applied to the target. - jqx-bulletchart-ticks-vertical - applied to ticks. When you create a custom style with colors and backgrounds for jqxBulletChart, you need to do the following: - Add the above CSS classes related to jqxBulletChart - After each CSS class, add your theme name. For example: jqx-bulletchart-summer - To apply your custom style to jqxBulletChart, you need to set its 'theme' property(option) to point to your theme name string. The pointer and target can also be styled by setting their **color** properties. If the range's or target's color is not set or it is set to *""*, the theme setting is applied. Ranges can be styled only by setting their **color** and **opacity**. ```html ``` - The sample below demonstrates how to set the 'summer' theme to jqxBulletChart and custom colors to its ranges. ```html jQuery Bullet Chart Styling Sample
``` --- ### jQuery BulletChart API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbulletchart/jquery-bullet-chart-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxbulletchart.txt #### Properties - `animationDuration` (Type: Function, Default: null): Sets ot gets the bulletcharts's animationDuration. - `barSize` (Type: Array, Default: 50%): Sets ot gets the bulletcharts's bar size. - `description` (Type: String, Default: 'Description'): Sets ot gets the bulletcharts's description. - `disabled` (Type: Boolean, Default: false): Disables the bullet chart. - `height` (Type: Number/String, Default: 100): Sets ot gets the bulletcharts's height. - `labelsFormat` (Type: String, Default: null): Sets ot gets the bulletcharts's labelsFormat. - `labelsFormatFunction` (Type: Function, Default: null): Sets ot gets the bulletcharts's labelsFormatFunction. - `orientation` (Type: String, Default: "horizontal"): Sets ot gets the bulletcharts's orientation. - `pointer` (Type: Object, Default: { value: 65, label: "Value", size: "25%", color: "" }): Sets ot gets the bulletcharts's pointer. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `ranges` (Type: Array, Default: [{ startValue: 0, endValue: 50, color: "#000000", opacity: 0.7 }, { startValue: 50, endValue: 80, color: "#000000", opacity: 0.5 }, { startValue: 80, endValue: 100, color: "#000000", opacity: 0.3}]): Sets ot gets the bulletcharts's range. - `showTooltip` (Type: Boolean, Default: true): Sets ot gets the bulletcharts's showTooltip.Requires jqxtooltip.js - `target` (Type: Object, Default: { value: 85, label: "Target", size: 4, color: "" };): Sets ot gets the bulletcharts's target. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `ticks` (Type: Object, Default: { position: "far", interval: 20, size: 10 }): Sets ot gets the bulletcharts's ticks. - `title` (Type: String, Default: 'Title'): Sets ot gets the bulletcharts's title. - `tooltipFormatFunction` (Type: Function, Default: null): Sets ot gets the bulletcharts's tooltipFormatFunction.Requires jqxtooltip.js - `width` (Type: Number/String, Default: 500): Sets ot gets the bulletcharts's width. #### Events - `change` (Type: Event): This event is triggered when the value is changed. #### Methods - `destroy` (Type: Method): Destroy the jqxBulletChart widget. - `render` (Type: Method): Renders the jqxBulletChart widget. - `refresh` (Type: Method): Refresh the jqxBulletChart widget. - `val` (Type: Method): Sets or gets the selected value. --- ### jQuery Buttons Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbutton/jquery-button-getting-started.htm > jQuery Buttons getting started: install jQWidgets, add jqxButtons to your app, see a complete example, then handle its events and call its methods. #### jqxButton The jqxButton represents a jQuery button widget that allows you to display a button on the Web page. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `2` scripts, listed below - **Demos:** [jQuery Button demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbutton/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbutton/jquery-button-api.htm) jqxButton in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbutton/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Button's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#button').jqxButton({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxbutton/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxButton widget requires the following files: ```html ``` The next step is to create an input element within the body of the html document. ```html ``` The last step is to initialize the widget by adding the following script to the html document: ```javascript $("#jqxbutton").jqxButton({ width: '150', height: '25'}); ``` To set a property(option), you need to pass the property name and value(s) in the jqxButton's constructor. ```javascript $("#jqxbutton").jqxButton({ disabled: true }); ``` To get a property(option), you need to pass the property name to the jqxButton's constructor. ```javascript const disabled = $("#jqxbutton").jqxButton('disabled'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get when the user clicks the button. The example code below demonstrates how to bind to the ‘click’ event of jqxButton. ```javascript $('#jqxButton').on('click', function (event) { alert('Button is Clicked'); }); ``` ##### Basic Push Button Sample ```html jQuery Button Sample1
``` #### jqxRepeatButton The jqxRepeatButton represents a button widget derived from the jqxButton. However, jqxRepeatButton give you control over when and how the 'click' event occurs. The jqxRepeatButton raises the 'click' event repeatedly from the time it is pressed until it is released. The interval between two 'click' events is specified by the 'delay' property(option). ##### Basic Repeat Button Sample ```html jQuery Repeat Button Sample1
``` #### jqxLinkButton The jqxLinkButton widget represents a button created from anchor element. ##### Basic Link Button Sample ```html jQuery Link Button Sample1
Link Button
``` #### jqxToggleButton The jqxToggleButton represents a button widget that switches its checked state after a click. ##### Basic Toggle Button Sample ```html jQuery Toggle Button Sample1
``` #### jqxSwitchButton The jqxSwitchButton represents a button widget that switches its checked state after a click. It is very similar to the jqxToggleButton, but it has different UI look. ##### Basic Switch Button Sample ```html jQuery Switch Button Sample

Horizontal Switch Button



Vertical Switch Button



``` #### jqxButtonGroup The jqxButtonGroup widget creates a set of buttons that can work as normal buttons, radio buttons or checkboxes. ##### Basic Sample ```html The jqxButtonGroup widget creates a set of buttons that can work as normal buttons, radio buttons or checkboxes.

Modes

Default
RadioButtons
CheckBoxes
``` --- ### jQuery Buttons Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbutton/jquery-button-styling-and-appearance.htm > Style the jQuery Buttons: the jqxButtons CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxButtons. - jqxButton, jqxRepeatButton, jqxLinkButton and jqxToggleButton Style - jqx-button - applied to jqxButton's outer div element. - jqx-link - applied to the jqxLinkButton's anchor element. - jqx-fill-state-normal - applied to button when it's state is default/normal. - jqx-fill-state-hover - applied to button when it's state is hovered i.e the mouse cursor is over the button. - jqx-fill-state-pressed - applied to button when it's state is pressed i.e the mouse button is down. - jqx-fill-state-disabled - applied to button it is disabled. When you create a custom style with colors and backgrounds for jqxButton, jqxRepeatButton, jqxLinkButton and jqxToggleButton, you need to do the following: - Add the above CSS classes related to jqxButtons - After each CSS class, add your theme name. For example: jqx-button-energyblue - To apply your custom style to jqxButtons, you need to set its 'theme' property(option) to point to your theme name string. ```javascript $("#jqxButton").jqxButton({theme: 'energyblue', width: '150', height: '25'}); ``` - The sample below demonstrates how to set the 'Energy Blue' theme to jqxButtons. ```html jQuery Button CSS Styling Sample
``` --- ### jQuery Buttons API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbutton/jquery-button-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxbutton.txt #### Properties - `delay` (Type: Number, Default: 50): Specifies the interval between two Click events. This property is available only in the jqxRepeatButton. The jqxRepeatButton raises Click events repeatedly when the button is pressed. - `disabled` (Type: Boolean, Default: false): Enables or disables the button. - `height` (Type: Number/String, Default: null): Sets or gets the button's height. - `imgSrc` (Type: String, Default: ""): Sets or gets the button's image source. - `imgWidth` (Type: Number, Default: 16): Sets or gets the button's image width. - `imgHeight` (Type: Number, Default: 16): Sets or gets the button's image height. - `imgPosition` (Type: String, Default: "center"): Sets or gets the button's image position. Possible values: "left", "top", "center", "bottom", "right", "topLeft", "bottomLeft", "topRight", "bottomRight". - `roundedCorners` (Type: String, Default: 'jqx-rc-all'): Enables or disables the rounded corners functionality. This property setting has effect in browsers which support CSS border-radius. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `enableDefault` (Type: Boolean, Default: true): Sets or gets the `enableDefault` property. - `cursor` (Type: String, Default: 'arrow'): Sets or gets the `cursor` property. - `textPosition` (Type: String, Default: ""): Sets or gets the button's text position. Possible values: "left", "top", "center", "bottom", "right", "topLeft", "bottomLeft", "topRight", "bottomRight". - `textImageRelation` (Type: String, Default: "overlay"): Sets or gets the button's text image relation. Possible values: "imageBeforeText", "imageAboveText", "textAboveImage", "textBeforeImage" and "overlay". - `theme` (Type: String, Default: ''): Sets the widget's theme. - `template` (Type: String, Default: 'default'): Determines the button's template as an alternative of the default styles. - `toggled` (Type: Boolean, Default: false): Sets or gets the button's toggle state. (available in jqxToggleButton). - `width` (Type: Number/String, Default: null): Sets ot gets the button's width. - `value` (Type: String, Default: ""): Sets or gets the button's value. #### Events - `click` (Type: Event): This event is triggered when the button is clicked. #### Methods - `check` (Type: Method): Checks the button. (available in jqxToggleButton). - `destroy` (Type: Method): Destroys the widget. - `focus` (Type: Method): Focuses the widget. - `render` (Type: Method): Renders the widget. - `toggle` (Type: Method): Toggles the button's checked state. (available in jqxToggleButton). - `unCheck` (Type: Method): Unchecks the button. (available in jqxToggleButton). - `val` (Type: Method): Sets or gets the value. #### Properties - `checked` (Type: Boolean, Default: false): Sets or gets the check state. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the switch button is disabled. - `height` (Type: Number/String, Default: null): Sets or gets the height. - `orientation` (Type: String, Default: 'horizontal'): Determines the jqxSwitchButton's orientation. - `onLabel` (Type: String, Default: 'On'): Sets or gets the string displayed when the button is checked. - `offLabel` (Type: String, Default: 'Off'): Sets or gets the string displayed when the button is unchecked. - `thumbSize` (Type: String, Default: '40%'): Sets or gets the size of the thumb in percentages. - `width` (Type: Number/String, Default: null): Sets or gets the width. #### Events - `checked` (Type: Event): This event is triggered when the switch button is checked. - `change` (Type: Event): This event is triggered when the switch button's state changes from one state to another. - `unchecked` (Type: Event): This event is triggered when the switch button is unchecked. #### Methods - `check` (Type: Method): Checks the button. - `disable` (Type: Method): Disables the switch button. - `enable` (Type: Method): Enables the switch button. - `toggle` (Type: Method): Toggles the check state. This method is automatically called when the user clicks the switch button. - `uncheck` (Type: Method): Unchecks the button. - `val` (Type: Method): Sets or gets the value. #### Properties - `animationType` (Type: String, Default: 'slide'): Sets or gets the type of the animation. - `autoOpen` (Type: Boolean, Default: false): Sets or gets whether the DropDown is automatically opened when the mouse cursor is moved over the widget. - `closeDelay` (Type: Number, Default: 400): Sets or gets the delay of the 'close' animation. - `disabled` (Type: Boolean, Default: false): Enables or disables the dropDownButton. - `dropDownHorizontalAlignment` (Type: String, Default: 'left'): Sets or gets the DropDown's alignment. - `dropDownVerticalAlignment` (Type: String, Default: 'bottom'): Sets or gets the DropDown's alignment. - `enableBrowserBoundsDetection` (Type: Boolean, Default: false): When this property is set to true, the popup may open above the button, if there's not enough available space below the button. - `height` (Type: Number/String, Default: null): Sets or gets the button's height. - `initContent` (Type: Function, Default: null): Sets a function which initializes the button's content. - `openDelay` (Type: Number, Default: 350): Sets or gets the delay of the 'open' animation. - `popupZIndex` (Type: Number, Default: 20000): Sets or gets the popup's z-index. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `template` (Type: String, Default: 'default'): Determines the template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `width` (Type: Number/String, Default: null): Sets or gets the button's width. #### Events - `close` (Type: Event): This event is triggered when the button's popup is closed. - `open` (Type: Event): This event is triggered when the button's popup is opened. #### Methods - `close` (Type: Method): Hides the button's content. - `destroy` (Type: Method): Destroys the widget. - `focus` (Type: Method): Focuses the widget. - `getContent` (Type: Method): Gets the button's content. The returned value is the button's content set through the "setContent" method. - `isOpened` (Type: Method): Returns true, if the drop down is opened. Otherwise returns false. - `open` (Type: Method): Shows the button's content. - `setContent` (Type: Method): Sets the button's content. The parameter could be a "string" or "html". #### Properties - `disabled` (Type: Boolean, Default: false): Enables or disables the jqxButtonGroup. - `enableHover` (Type: Boolean, Default: false): Enables or disabled the highlight state. - `mode` (Type: String, Default: 'default'): Sets or gets the jqxButtonGroup's mode. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `template` (Type: String, Default: 'default'): Determines the template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. #### Events - `buttonclick` (Type: Event): This event is triggered when a button is clicked. - `selected` (Type: Event): This event is triggered when a button is selected - in checkboxes or radio buttons mode. - `unselected` (Type: Event): This event is triggered when a button is unselected - in checkbox or radio buttons mode. #### Methods - `disableAt` (Type: Method): Disables a button at specific index. - `disable` (Type: Method): Disables jqxButtonGroup. - `destroy` (Type: Method): Destroys the widget. - `enable` (Type: Method): Enables the jqxButtonGroup. - `enableAt` (Type: Method): Enables a button at specific index. - `focus` (Type: Method): Focuses the widget. - `getSelection` (Type: Method): Gets the index or indexes of the selected button(s). - `render` (Type: Method): Renders the widget. - `setSelection` (Type: Method): Selects a button in checkbox or radio buttons mode --- ### jQuery Barcode Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbarcode/jqxbarcode-getting-started.htm > jQuery Barcode getting started: install jQWidgets, add jqxBarcode to your app, see a complete example, then handle its events and call its methods. jqxBarcode represents a widget which displays different types of bar codes. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the JavaScript files and CSS dependencies to your project. The jqxBarcode widget requires the following files: ```html ``` The next step is to create html element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function (method), you need to pass the method name and parameters (if any) in the jqxBarcode's constructor. ```javascript $("#jqxBarcode").jqxBarcode('isValid'); ``` To set a property (option), you need to pass the property name and value(s) in the jqxBarcode's constructor. ```javascript $("#jqxBarcode").jqxBarcode({ value: 'codabar' }); ``` To get a property (option), you need to pass the property name to the jqxBarcode's constructor. ```javascript const value = $("#jqxBarcode").jqxBarcode('value'); ``` To bind to an event of a UI widget, you can use basic Javascript syntax. Let’s suppose that you want to get the selected value after the user change the current one. The example code below demonstrates how to bind to the ‘resize’ event of jqxBarcode. ```javascript $("#jqxBarcode").on(‘invalid’, function (event) { }); ``` #### Basic jqxBarcode Sample ```html Barcode basic demo.
https://www.jqwidgets.com/
``` --- ### jQuery Barcode API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbarcode/jqxbarcode-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxbarcode.txt #### Properties - `backgroundColor` (Type: string, Default: white): Sets the background color of the qrcode element. - `displayLabel` (Type: boolean, Default: true): Sets whether the qrcode label is visible. - `labelColor` (Type: string, Default: black): Sets the color of the qrcode label. - `labelFont` (Type: string, Default: monospace): Sets the font family of the qrcode label. - `labelFontSize` (Type: number, Default: 14): Sets the font size of the qrcode label. - `labelMarginBottom` (Type: number, Default: 5): Sets the bottom margin of the qrcode label. - `labelMarginTop` (Type: number, Default: 5): Sets the top margin of the qrcode label. - `labelPosition` (Type: string, Default: bottom): Sets the position of the qrcode label. - `lineColor` (Type: string, Default: black): Sets the color of the qrcode lines. - `lineHeight` (Type: number, Default: 50): Sets the height of the qrcode line. - `lineWidth` (Type: number, Default: 4): Sets the width of the qrcode line. - `renderAs` (Type: string, Default: svg): Sets the rendering mode of the qrcode. - `type` (Type: string, Default: codabar): Sets the qrcode type - `value` (Type: string): Sets or gets the value of the qrcode. #### Events - `invalid` (Type: Event): This event is triggered when the value of the qrcode is invalid. #### Methods - `export` (Type: Method): Exports the qrcode. - `getDataURL` (Type: Method): Gets the base64 string of the qrcode - `getDataURLAsync` (Type: Method): Gets the base64 string of the qrcode - `isValid` (Type: Method): Gets the validity of the qrcode --- ### jQuery Calendar Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcalendar/jquery-calendar-getting-started.htm > jQuery Calendar getting started: install jQWidgets, add jqxCalendar to your app, see a complete example, then handle its events and call its methods. jqxCalendar represents a jQuery calendar widget that enables the user to select a date using a visual monthly calendar display. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `5` scripts, listed below - **Demos:** [jQuery Calendar demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcalendar/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcalendar/jquery-calendar-api.htm) jqxCalendar in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcalendar/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Calendar's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#calendar').jqxCalendar({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcalendar/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxCalendar widget requires the following files: ```html ``` The next step is to create html element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxCalendar’s constructor. ```html $("#jqxcalendar").jqxCalendar(‘setDate’, new Date(2026, 0, 26)); ``` To get the result of a function after calling it, you can use the following syntax: ```html var selectedDate = $("#jqxcalendar'").jqxCalendar(‘getDate’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxCalendar's constructor. ```html $("#jqxcalendar").jqxCalendar({ firstDayOfWeek: 1 }); ``` To get a property(option), you need to pass the property name to the jqxCalendar's constructor. ```html const dayOfWeek = $("#jqxcalendar").jqxCalendar('firstDayOfWeek'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the selected date after the user clicks on a cell. The example code below demonstrates how to bind to the ‘valuechanged’ event of jqxCalendar. ```html $('#jqxcalendar').on('change', function (event) { const jsDate = event.args.date; const type = event.args.type; // keyboard, mouse or null depending on how the date was selected. // if the selectionMode is set to 'range'. // var range = event.args.range; // var rangeFrom = range.from; // var rangeTo = range.to; // additional properties. // var view = event.args.view; // var viewFrom = view.from; // var viewTo = view.to; }); ``` #### Basic Sample ```html jQuery Calendar Sample
``` --- ### jQuery Calendar Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcalendar/jquery-calendar-styling-and-appearance.htm > Style the jQuery Calendar: the jqxCalendar CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxCalendar. - jqx-widget - applied to the jqxCalendar widget. - jqx-calendar - applied to jqxCalendar widget. - jqx-calendar-row-header - applied to the calendar's row header. This header displays the week numbers. - jqx-calendar-column-header - applied to the calendar's column. This header displays the day names. - jqx-calendar-top-left-header - applied to the calendar's top-left header. This header is displayed before the day names and above the week numbers. - jqx-calendar-title-navigation - applied to the calendar's navigation buttons. - jqx-calendar-title-header - applied to the calendar's navigation title. - jqx-calendar-title-header-disabled - applied to the calendar's navigation title when the calendar is disabled. - jqx-calendar-cell - applied to a calendar cell. - jqx-calendar-cell-hidden - applied to a calendar cell when the cell is hidden. A cell can be hidden when the showOtherMonthDays property is false and the calendar hides the cells with dates from the other months. - jqx-calendar-cell-weekend - applied to a calendar cell when the cell's date is a weekend date. - jqx-calendar-cell-specialDate - applied to a calendar cell when the cell's date is a special date(holiday, vacation, birthday). - jqx-calendar-cell-today - applied to a calendar cell when the cell's date is the today date. - jqx-calendar-cell-hover - applied to a calendar cell when the cell is hovered. - jqx-fill-state-hover - applied to a calendar cell when the cell is hovered. - jqx-calendar-cell-selected - applied to a calendar cell when the cell is selected. - jqx-fill-state-pressed - applied to a calendar cell when the cell is selected. - jqx-calendar-cell-othermonth - applied to a calendar cell when the cell's date represents a date from the previous or next month. - jqx-calendar-cell-disabled - applied to a calendar cell when the calendar is disabled - jqx-calendar-row-cell - applied to a calendar cell when the cell is from the row header that displays the week numbers. - jqx-calendar-row-cell-disabled - applied to a calendar cell when the cell is from the row header that displays the week numbers and the calendar is disabled. - jqx-calendar-column-cell - applied to a calendar cell when the cell is from the column header that displays the day names. - jqx-calendar-column-cell-disabled - applied to a calendar cell when the cell is from the column header that displays the day names and the calendar is disabled. - jqx-calendar-view - applied to the calendar's cell area element. - jqx-fill-state-disabled - applied to the calendar when it is disabled. When you create a custom style with colors and backgrounds for jqxCalendar, you need to do the following: - Add the above CSS classes related to jqxCalendar - After each CSS class, add your theme name. For example: jqx-calendar-themename - To apply your custom style to jqxCalendar, you need to set its 'theme' property(option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Summer' theme to jqxCalendar. ```html jQuery Calendar CSS Styling Sample
``` --- ### jQuery Calendar API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcalendar/jquery-calendar-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxcalendar.txt #### Properties - `backText` (Type: String, Default: Back): Sets or gets the tooltip text displayed when the mouse cursor is over the back navigation button. - `columnHeaderHeight` (Type: Number, Default: 20): Sets or gets the Calendar column header's height. In the column header are displayed the calendar day names. - `clearString` (Type: String, Default: 'Clear'): Sets or gets the 'Clear' string displayed when the 'showFooter' property is true. - `culture` (Type: String, Default: default): Sets or gets the jqxCalendar's culture. The culture settings are contained within a file with the language code appended to the name, e.g. jquery.glob.de-DE.js for German. - `dayNameFormat` (Type: String, Default: 'firstTwoLetters'): Sets or gets the name format of days of the week. - `disabled` (Type: Boolean, Default: false): Disables (true) or enables (false) the calendar. Can be set when initialising (first creating) the calendar. - `enableWeekend` (Type: Boolean, Default: false): Sets or gets a value indicating whether weekend persists its view state. - `enableViews` (Type: Boolean, Default: true): Determines whether switching between month, year and decade views is enabled. - `enableOtherMonthDays` (Type: Boolean, Default: true): Sets or gets a value indicating whether the other month days are enabled. - `enableFastNavigation` (Type: Boolean, Default: true): Sets or gets a value indicating whether the fast navigation is enabled. - `enableHover` (Type: Boolean, Default: true): Sets or gets a value indicating whether the hover state is enabled. The hover state is activated when the mouse cursor is over a calendar cell. - `enableAutoNavigation` (Type: Boolean, Default: true): Sets or gets a value indicating whether the auto navigation is enabled. When this property is true, click on other month date will automatically navigate to the previous or next month. - `enableTooltips` (Type: Boolean, Default: false): Sets or gets a value indicating whether the tool tips are enabled. - `forwardText` (Type: String, Default: Forward): Sets or gets the tooltip text displayed when the mouse cursor is over the forward navigation button.EnableTooltips property should be set to true. - `firstDayOfWeek` (Type: Number, Default: 0): Sets or gets which day to display in the first day column. By default the calendar displays 'Sunday' as first day. - `height` (Type: Number/String, Default: null): Sets or gets the height of the Calendar. - `min` (Type: Date, Default: 1900, 1, 1): Represents the minimum navigation date. - `max` (Type: Date, Default: 2100, 1, 1): Represents the maximum navigation date. - `navigationDelay` (Type: Number, Default: 400): Determines the animation delay between switching views. - `rowHeaderWidth` (Type: Number, Default: 25): Sets or gets the row header width. - `readOnly` (Type: Boolean, Default: false): Sets or gets the calendar in read only state. - `restrictedDates` (Type: Array, Default: []): Sets or gets the calendar's restricted dates. These are dates which cannot be clicked. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `stepMonths` (Type: Number, Default: 1): Represents the calendar`s navigation step when the left or right navigation button is clicked. - `showWeekNumbers` (Type: Boolean, Default: true): Sets or gets a value whether the week`s numbers are displayed. - `showDayNames` (Type: Boolean, Default: true): Sets or gets a value whether the day names are displayed. By default, the day names are displayed. - `showOtherMonthDays` (Type: Boolean, Default: true): Sets or gets a value whether the other month days are displayed. - `showFooter` (Type: Boolean, Default: false): Sets or gets a value indicating whether the calendar's footer is displayed. - `selectionMode` (Type: String, Default: 'default'): Sets or gets the selection mode. - `specialDates` (Type: Array, Default: new Array()): Sets or gets a special date to the Calendar. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `titleHeight` (Type: Number, Default: 25): Sets or gets the title height where the navigation arrows are displayed. - `titleFormat` (Type: Array, Default: ["MMMM yyyy", "yyyy", "yyyy"]): Sets or gets the title format for the title section. - `todayString` (Type: String, Default: 'Today'): Sets or gets the 'Today' string displayed when the 'showFooter' property is true. - `value` (Type: Date, Default: Today): Sets or gets the Calendar's value. - `width` (Type: Number/String, Default: null): Sets or gets the width of the Calendar. #### Events - `backButtonClick` (Type: Event): This event is triggered when the calendar back navigation button is clicked. - `change` (Type: Event): This event is triggered when the Calendar's selection is changed. - `nextButtonClick` (Type: Event): This event is triggered when the calendar next navigation button is clicked. - `viewChange` (Type: Event): This event is triggered when the Calendar's view is changed. #### Methods - `clear` (Type: Method): Clears the selection. - `destroy` (Type: Method): Destroys the widget. - `focus` (Type: Method): Focuses the Calendar. - `addSpecialDate` (Type: Method): Calls `addSpecialDate`. - `getMinDate` (Type: Method): When the getMinDate method is called, the user gets the lowest navigation date set to the Calendar. - `getMaxDate` (Type: Method): When the getMaxDate method is called, the user gets the highest navigation date set to the Calendar. The returned value is a JavaScript Date object. - `getDate` (Type: Method): When the getDate method is called, the user gets the current month displayed in the Calendar.The returned value is a JavaScript Date Object. - `getRange` (Type: Method): Gets the selection range when the selectionMode is set to 'range'. The returned value is an object with "from" and "to" fields. Each of these is a JavaScript Date Object. - `navigateForward` (Type: Method): When the navigateForward method is called, the calendar navigates forward with a specific month step(by default 1). - `navigateBackward` (Type: Method): When the navigateBackward method is called, the calendar navigates backward with a specific month step(by default 1). - `render` (Type: Method): Renders the Calendar. - `refresh` (Type: Method): Performs a layout and updates the UI. - `setMinDate` (Type: Method): When the setMinDate method is called, the user sets the lowest date to which it is possible to navigate. - `setMaxDate` (Type: Method): When the setMaxDate method is called, the user sets the highest date to which it is possible to navigate. - `setDate` (Type: Method): When the setDate method is called, the user sets the current month displayed in the Calendar. The parameter is a JavaScript Date Object. - `setRange` (Type: Method): Sets the selection range when the selectionMode is set to 'range'. The parameters are JavaScript Date Objects. - `today` (Type: Method): Sets the Date to Today. - `val` (Type: Method): Gets or sets the jqxCalendar's value. --- ### jQuery Chart Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-getting-started.htm > jQuery Chart getting started: install jQWidgets, add jqxChart to your app, see a complete example, then handle its events and call its methods. jqxChart is a lightweight and powerful chart widget written 100% in javascript. It offers many advanced features and supports three different rendering technologies - SVG, HTML5 Canvas & VML. You can use jqxChart to add interactive charts to your website, build custom dashboards, or use it in your mobile applications. jqxChart offers excellent cross-browser compatibility and works well with both desktop and mobile browsers. jqxChart is being used by thousands of individual developers, small companies as well as a significant percentage of the Fortune 100 companies. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `4` scripts, listed below - **Demos:** [jQuery Chart demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-api.htm) jqxChart in the [Line Series](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Chart's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#chart').jqxChart({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/index.htm) show every option with its source code; the guide below explains them. #### Basic concepts Before you start using jqxChart you need to learn how it works and some basic concepts. Depending on which features you use, your chart may contain the following elements: - horizontal axis (xAxis) - vertical axis (valueAxis) - title & description - one or more series groups and series - grid lines & tick marks - legend - border line - background - tooltips - annotations - range selector Some simple charts may not have all of these elements, while complicated charts could be highly customized and even include additional elements added through custom drawing. Take a look at the following picture to learn more about the different elements: #### Getting Started ##### Include all required javascript & css files jqxChart does not need jQuery: jqxcore.js has the small DOM layer it uses, and you can still add jQuery if your page uses it. Include the jQWidgets core framework file - jqxcore.js, the jQWidgets data binding file - jqxdata.js, the main jqxChart plug-in file - jqxchart.core.js file, the drawing plug-in file - jqxdraw.js and the base jQWidgets stylesheet - jqx.base.css: ##### Create a DIV element inside the body of your page You need to define an element which will serve as a container for the chart. DIV elements are convenient because you can easily position them and specify a size of your choice. Give the DIV element an ID like 'chartContainer' or something that you like. ##### Prepare sample data jqxChart can load data from multiple data source like JSON, XML, CSV and TAB delimited files. Here we'll define and use a simple javascript array of objects. This code must be placed inside the $(document).ready function: ##### Prepare the chart settings and initialize the chart The final step is to prepare the chart display settings and initialize the chart. The code below specifies the title and description that the chart will display and sets the dataSource property. In this example we bind the Category Axis (horizontal X axis) to the Day property of our data source. The chart will display the data in three series of type 'column'. Each of the series is bound to one of the properties in our data source. The complete source code for this example is here: --- ### Chart Types Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-types.htm > jqxChart supports several common chart types. You can easily plot series of different types within the same chart. jqxChart supports several common chart types. You can easily plot series of different types within the same chart. A type must be specified for each series group. Currently jqxChart supports the following series types: The following code defines a single series group with three series which will be rendered as lines: If you want to display multiple of series with different types you can define several series groups and change the type property. --- ### Working with Chart Series Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-working-with-chart-series.htm > jqxChart allows you to visualize data in multiple series. In jqxChart series are grouped together into series groups. jqxChart allows you to visualize data in multiple series. In jqxChart series are grouped together into series groups. A series group specifies the type of the series in the group and contains the definition and one or more series bound the data fields in the source. In addition, a series group may have its own valueAxis and xAxis. For example, imagine you're working with the following JavaScript array of objects which defines seven data records: The following code defines two series group of different type: In the above example the series group type is 'line' which means that the data points will be connected by lines. The valueAxis definition specifies the minimum and the maximum value to display on the Y-axis as well as the unit interval and the text to display next to the Y-axis. This series group contains three different series. Each of them will render data corresponding to the dataField that it binds to. In this example, the data will be displayed as 3 lines connecting the respective data points for Keith, Erica and George. The first line will connect the points with Y-values of 30, 25, 30, 35, 20, 30, 60. --- ### Chart Events Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-events.htm > jQuery Chart: here is the example's source code. Part of the jQWidgets jQuery documentation. | jqxChart raises events when the user moves in or out of a series element displayed, clicks on an element, changes the selection of a range selector and more. For complete list of events please check the API reference. To handle chart events you need to implement event handlers. An event handler function must accept one argument which contains information about the event. When jqxChart raises an event, it will include all related event information in an arguments object and pass with the event as a property. Each event information contains the follow properties: The following example demonstrates the mouseover, mouseout and click events: Move the mouse cursor over the columns in the chart below and click on them | | --- | Here is the example's source code: --- ### Text Styling and Formatting Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-formatting.htm > In jqxChart you can change the default style for all text elements using Cascading Style Sheets (CSS). #### Text font, size & colors In jqxChart you can change the default style for all text elements using Cascading Style Sheets (CSS). You must edit the styles defined in jqx.base.css located inside the jqwidgets\styles directory or the.css file of the theme you are using in your project. jqxChart uses the following styles: - **jqx-chart-axis-text** - Text style for the units and values display on the Y-axis and X-axis. - **jqx-chart-label-text** - Text style for all labels. - **jqx-chart-tooltip-text** - Tooltips text style. - **jqx-chart-legend-text** - Style for the the chart's legend texts. - **jqx-chart-axis-description** - Style for the Axis description text. - **jqx-chart-title-text** - Title style. - **jqx-chart-title-description** - Style for the text description displayed below the title. #### Text formatting jqxChart allows you to format text in two different ways. The first approach is to use the formatSettings property which is available for each series group, series and axis. The series and series group settings affect the formatting of labels and tooltips. The axis format settings affect the formatting of the labels displayed along the axis. The formatSettings property provides the following options: **decimalSeparator** - character used as a decimal separator. If not specified the default separator is '.' **thousandsSeparator** - character used as thousands separator. Default value is ',' **decimalPlaces** - number of digits after the decimal separator. Default value is 2 for floating point numbers. **negativeWithBrackets** - boolean which specifies whether to display negative numbers in brackets. Default value is false. **perfix** - any string which will be added as a prefix. Default value is empty. **sufix** - any string which will be added as a sufix. Default value is empty. **dateFormat** - optional date format string. This property is applicable only when displaying Date objects. The second approach is more powerful. It allows you to use a custom text formatting function written in JavaScript. The function is required to accept at least one parameter which is the value that will be formatted. jqxChart will call the function every time it needs to format and display a value. You can specify a custom format function for each series group, series or axis. The following example is a simple format function which returns the month for a given date value: ```javascript formatFunction: function (value, itemIndex, serie, group) { var days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; return days[value]; } ``` #### Tooltips formatting In order to format the tooltips, you can use the 'toolTipFormatFunction' which works the same way as the formatFunction. It accepts one parameter which is the value that will be formatted and returns a string. The following example is a simple format function for the jqxChart tooltips which returns a formatted Date string for a given date value: ```javascript toolTipFormatFunction: function(value, itemIndex, serie, group, xAxisValue, xAxis) return value.getDate() + '-' + months[value.getMonth()] + '-' + value.getFullYear(); } ``` jqxChart uses priorities to determine which format settings or format function to use. When available, format functions are used instead of format settings. For example, if you specify both, jqxChart will use the format function and ignore the format settings. When neither a format function nor format settings are specified for a series, jqxChart will try to use the format function or the format settings specified for the series group. If neither is available it will use default settings. The following code shows the usage of format settings: --- ### Tooltip settings and content formatting Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-tooltips-documentation.htm > The tooltips in jqxChart provide a great way of displaying more content when the user positions over a specific data point. #### Turning tooltips on and off ```javascript $('#myChartElement').jqxChart('showToolTips', false); ``` #### Tooltips delay ```javascript // show tooltips after 1 second $('#myChartElement').jqxChart('toolTipShowDelay', 1000); // hide tooltips after 5 seconds $('#myChartElement').jqxChart('toolTipHideDelay', 5000); ``` #### Tooltips format settings - prefix - a string that will appear at the beginning of the text. - sufix - a string that will appear at the end of the text. - decimalSeparator - a symbol used to mark the border between the integer and fractional part of a number. - thousandsSeparator - a symbol used to mark the border between thousands, millions, billions, etc. - decimalPlaces - the number of digits displayed after the decimal separator. - negativeWithBrackets - a boolean value indicating whether to display negative numbers in brackets. - dateFormat - optional date format string. This property is applicable only when displaying Date objects. ```javascript var sampleData = [ { Country: 'Switzerland', Inflation2012: -0.95, Inflation2011: -0.72 }, { Country: 'USA', Inflation2012: 2.35, Inflation2011: 2.96 }, { Country: 'Germany', Inflation2012: 2.03, Inflation2011: 2.10 }, { Country: 'India', Inflation2012: 8.38, Inflation2011: 6.49 }, { Country: 'China', Inflation2012: 3.34, Inflation2011: 4.06 }, { Country: 'Canada', Inflation2012: 2.05, Inflation2011: 2.30 }]; var settings = { title: "CPI inflation comparison by country", description: "Years: 2011 vs 2012", showLegend: true, enableAnimations: true, padding: { left: 20, top: 5, right: 20, bottom: 5 }, titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }, source: sampleData, xAxis: { dataField: 'Country', toolTipFormatSettings: { prefix: 'Country: ' } }, colorScheme: 'scheme02', seriesGroups: [ { type: 'column', orientation: 'horizontal', columnsGapPercent: 50, valueAxis: { displayValueAxis: true, description: '', unitInterval: 1, minValue: -5, maxValue: 10, formatSettings: { sufix: '%' } }, toolTipFormatSettings: { sufix: '%', decimalPlaces: 3, decimalSeparator: '.', negativeWithBrackets: true }, series: [ { dataField: 'Inflation2012', displayText: 'Inflation 2012' }, { dataField: 'Inflation2011', displayText: 'Inflation 2011' }] }] }; $('#jqxChart').jqxChart(settings); ``` #### Tooltips format function - value - the y-axis value of the currently selected element. - itemIndex - the 0-based index of the selected element in the data source. - series - the object representing the series of the selected element. - serieGroup - the object representing the series group of the selected element. - xAxisValue - the x-axis value of the selected element. - xAxis - the object representing the x-axis of the selected element. ```javascript var data = [ { "month": "Jan", "min": -1.9, "max": 3.7, "avg": 0.2 }, { "month": "Feb", "min": -0.9, "max": 5.9, "avg": 1.1 }, { "month": "Mar", "min": 0.8, "max": 9.8, "avg": 4.9 }, { "month": "Apr", "min": 4.1, "max": 13.9, "avg": 8.7 }, { "month": "May", "min": 8.0, "max": 18.4, "avg": 13.1 }, { "month": "Jun", "min": 11.3, "max": 22.2, "avg": 16.6 }, { "month": "Jul", "min": 13.3, "max": 25.3, "avg": 18.4 }, { "month": "Aug", "min": 13.0, "max": 24.4, "avg": 17.6 }, { "month": "Sep", "min": 10.3, "max": 20.8, "avg": 14.3 }, { "month": "Oct", "min": 6.6, "max": 14.9, "avg": 9.2 }, { "month": "Nov", "min": 2.1, "max": 8.4, "avg": 4.2 }, { "month": "Dec", "min": -0.5, "max": 4.5, "avg": 1.5 } ]; var toolTipCustomFormatFn = function (value, itemIndex, serie, group, xAxisValue, xAxis) { var dataItem = data[itemIndex]; return '
Month: ' + xAxisValue + '
Min: ' + dataItem.min + '°
Max: ' + dataItem.max + '°
Average: ' + dataItem.avg + '°
';> }; var settings = { title: "Weather in Geneva, Switzerland", description: "Climatological Information about Geneva", enableAnimations: true, showLegend: true, padding: { left: 5, top: 5, right: 5, bottom: 5 }, titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }, source: data, xAxis: { dataField: 'month', unitInterval: 1 }, colorScheme: 'scheme05', seriesGroups: [ { type: 'columnrange', columnsGapPercent: 100, toolTipFormatFunction: toolTipCustomFormatFn, valueAxis: { unitInterval: 5, title: {text: 'Temperature [C]'}, minValue: -5, maxValue: 30 }, series: [ { dataFieldTo: 'max', displayText: 'Temperature Range', dataFieldFrom: 'min' } ] }, { type: 'spline', toolTipFormatFunction: toolTipCustomFormatFn, valueAxis: { unitInterval: 5, displayValueAxis: false, minValue: -5, maxValue: 30 }, series: [ { dataField: 'avg', displayText: 'Average Temperature', lineWidth: 2 } ] } ] }; $('#jqxChart').jqxChart(settings); ``` #### Tooltip colors and style ```javascript series: [ { dataField: 'avg', toolTipClass: myTooltipClass, toolTipLineColor: '#FF0000', toolTipBackground: '#00FF00' } ] ``` --- ### Chart Data Sources Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-data-source.htm > The Chart plugin can be bound to multiple types of data collections including arrays, xml, json, tsv, csv or remote data. The Chart plugin can be bound to multiple types of data collections including arrays, xml, json, tsv, csv or remote data. To data bind the Chart to a data source you need to initialize and set its source property. Let's see how to visualize XML data. This is the XML Data file that we use to build the Chart. Create a HTML file called Chart.html that contains the following HTML code: ```html jqxChart Line Series Example
``` In the Head section of the page, we include the jQuery javascript file, the jQWidgets core framework file – jqxcore.js, the jQWidgets data binding file – jqxdata.js, the main jqxChart plug-in file – jqxchart.js file, and the base jQWidgets stylesheet – jqx.base.css. On to the body of the page. we create a DIV tag as the placeholder for the chart with a unique ID = “jqxChart”. The chart is then instantiated using the jqxChart constructor function. The constructor takes in the following parameters: source – dataAdapter object, categoryAxis and seriesGroups objects, colorScheme(available values are from ‘scheme01′ to ‘scheme11′), showLegend(displays the legend section in the chart) and the Chart title. In the source object initialization, we specify the datafields array, the root and record properties, the url(points to a xml data file) and we set the datatype to ‘xml’. In the seriesGroup object, the series group type is ‘column’ which means that the data will be visualized by columns. The valueAxis definition specifies the appearance of the Y-axis. This series group contains one series that will render data corresponding to the Quantity dataField that it binds to. In this example we bind the Category Axis (horizontal X axis) to the Date property of our data source. #### What happens when the data source is changed? How to refresh the Chart? To refresh the Chart, you need to simply set its 'source' property again. In the example code below, the Chart is using the xmldata.xml as a data source. When the 'Refresh Data' button is clicked, the Chart's data source becomes the xmldata2.xml file. ```html jqxChart XML Data visualization
``` #### The result of the above code is: Here's the xmldata2.xml: #### Bind the Chart to MySQL Database using PHP Let's see how to connect the jqxChart to MySql Database using PHP. The data will be obtained from MySql Database and especially the Northwind Database. The data will be returned in JSON format. You can download the Northwind database.sql script [here](http://code.google.com/p/northwindextended/downloads/detail?name=Northwind.MySQL5.sql) and run it into MySQL to create the database. The first thing we need to do is create the file we’ll connect with. We’ll call this file connect.php. ```html ``` Now we have our file to do the connection for us and we need to create the file that will run the query and bring the data so our Chart can be populated. We will call the file data.php. ```html prepare($query); $result->bind_param('ii', $from, $to); $result->execute(); /* bind result variables */ $result->bind_result($OrderDate, $ProductName, $Quantity); /* fetch values */ while ($result->fetch()) { $orders[] = array( 'OrderDate' => $OrderDate, 'ProductName' => $ProductName, 'Quantity' => $Quantity ); } echo json_encode($orders); /* close statement */ $result->close(); /* close connection */ $mysqli->close(); ?> ``` The data is returned as JSON. This is it for the connection and data gathering. Let’s see how to add the data we just gathered into our jQuery Chart. Create the index.php file and add references to the following javascript and css files. ```html ``` Create a div tag for the Chart. ```html
``` Create your Chart and load the data. We define a source object for the Chart and bind that source to the data.php which returns the JSON data. We also set up the settings object and define the chart’s categoryAxis(horizontal X axis), valueAxis(vertical Y axis) and the chart series. For more information about the Chart’s initialization visit this help topic: [jquery-chart-getting-started.htm](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-getting-started.htm) ```html ``` #### Load the Chart from Array In the following code example, the Chart is loaded from the 'sampleData' array. --- ### Axis properties and settings Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-axes.htm > jqxChart has two main types of axes - valueAxis and xAxis. Typically the valueAxis represents the vertical axis in the chart although you may choose to rotate… jqxChart has two main types of axes - valueAxis and xAxis. Typically the valueAxis represents the vertical axis in the chart although you may choose to rotate the axes and in this case the valueAxis will be displayed horizontally. Please take a look at the following picture to learn more about the different elements of the axes: The labels displayed along the valueAxis are derived from the values of the series displayed in the chart. The labels along the xAxis are derived from the values of the 'dataField' property in your data source. In case you don't specify a dataField property, the xAxis will show sequential numbers corresponding to each record in the data source. #### Common axis properties Both the valueAxis and the xAxis have a set of common properties and settings. Most of the properties are optional and if you don't change them jqxChart will use default settings. Here is a list of the common properties that you may change: - visible - a boolean determining whether the axis is visible. - minValue - sets the minimum value of the axis. If not set the chart will use the maximum value from the data source. - maxValue - sets the maximum value of the axis. If not set the chart will use the minimum value from the data source. - unitInterval - an integer value which determines the interval between the values along the axis. If not set the chart will automatically calculate the size of the interval. The algorithm will try to ensure that all labels, grid lines and tick marks fit well depending on the size of the axis and the total number of data points. - axisSize - an integer which determines the size of the axis. This property is optional as the chart can automatically calculate the required size. - flip - specifies whether the values are displayed in reverse order. - position - determines the position of the axis. - left - the axis will be displayed on the left side of the chart. This is applicable to valueAxis (or xAxis in case of axis rotation). - right - the axis will be displayed on the right side of the chart. This is applicable to valueAxis (or xAxis in case of axis rotation). - top - the axis will be displayed at the top of the chart. This is applicable to xAxis (or valueAxis in case of axis rotation). - bottom - the axis will be displayed at the bottom of the chart. This is applicable to xAxis (or valueAxis in case of axis rotation). - padding - determines the left, right, top and bottom padding of the axis. - left - integer representing left padding of the axis. It's applicable to vertical axes. - right - integer representing right padding of the axis. It's applicable to vertical axes. - top - integer representing top padding of the axis. It's applicable to horizontal axes. - bottom - integer representing bottom padding of the axis. It's applicable to horizontal axes. - title - a collection of properties describing how to display the title of the axis. - visible - a boolean determining whether the title is visible. - text - a string representing the text of the axis title. - class - a string representing the CSS class of the axis title. - horizontalAlignment - horizontal alignment of the axis title. Valid values are 'left', 'center', 'right'. - verticalAlignment - vertical alignment of the axis title. Valid values are 'top', 'center', 'bottom'. - labels - a collection of properties describing how to display the labels along the axis. - visible - a boolean determining whether the labels is visible. - step - an integer value which determines the labels' intervals step. - class - a string representing the CSS class of the axis labels. - formatSettings - settings used to format the labels. - prefix - a string that will appear at the beginning of the text. - sufix - a string that will appear at the end of the text. - decimalSeparator - a symbol used to mark the border between the integer and fractional part of a number. - thousandsSeparator - a symbol used to mark the border between thousands, millions, billions, etc. - decimalPlaces - the number of digits displayed after the decimal separator. - negativeWithBrackets - a boolean value indicating whether to display negative numbers in brackets. - formatFunction - callback function used to format the labels. - angle - an integer representing the labels rotation angle in degrees. - rotationPoint - position to rotate the text around, e.g. 'lefttop', 'leftcenter', 'leftbottom', 'centertop', etc. - horizontalAlignment - horizontal alignment of the axis labels. Valid values are 'left', 'center', 'right'. - verticalAlignment - vertical alignment of the axis labels. Valid values are 'top', 'center', 'bottom'. - offset - custom horizontal and vertical labels position offset, e.g. {x: 5, y: 2} - autoRotate - a boolean which determines whether to enable automatic labels rotation. This property is applicable to pie, donut, polar and spider charts. - gridLines - a collection of properties describing how to display the axis grid lines. - visible - a boolean determining whether the grid lines are visible. - step - an integer value which determines the the grid lines' interval step. - color - a string representing color of the grid lines. - lineWidth - an integer representing the line width of the grid lines. The default value is 1. - dashStyle - a string sequence of numbers representing line and space lengths, e.g. '2,2'. - tickMarks- a collection of properties describing how to display the axis tick marks lines - visible - a boolean determining whether the tick marks are visible. - step - an integer value which determines the tick marks' interval step. - color - a string representing color of the tick marks lines. - size - an integer representing the size of the tick marks. The default value is 4. - lineWidth - an integer representing the line width of the tick marks. The default value is 1. - dashStyle - a string sequence of numbers representing line and space lengths, e.g. '2,2'. - line - a collection of properties describing line of the axis - visible - a boolean determining whether the axis line is visible. - color - a string representing color of the axis line. - lineWidth - an integer representing the width of the axis line. The default value is 1. - dashStyle - a string sequence of numbers representing line and space lengths, e.g. '2,2'. - alternatingBackgroundColor - alternating background color between grid lines. - alternatingBackgroundColor2 - second alternating background color. - alternatingBackgroundOpacity - opacity of the alternating background. #### xAxis specific properties There are several properties which are applicable only to the xAxis: - type - the type of the xAxis. Values can be: - 'default' - auto detects and switches to 'basic', 'linear' or 'date' - 'date'- when displaying dates - 'basic' - displays all data points sequentially - 'linear' - linear arrangement by the value of the category axis data field - baseUnit - the base unit when used with 'date' axis. Values can be 'year', 'month', 'day', 'hour', 'minute', 'second' or 'millisecond'. - valuesOnTicks - specifies whether the axis values will be aligned with the tick marks. - dataField - name of the field in the data source. The values of this field will be displayed along the axis. - displayField - This field is optional and it is used in the preparation of the default tooltips text. - rangeSelector - definition of a range selector on the xAxis. For more details check the rangeSelector help topic and examples. #### valueAxis specific properties Similarly several properties are applicable only to the valueAxis: - baselineValue - an integer representing the baseline value for the axis. The default value is 0. - logarithmicScale - a boolean representing whether to use logarithmic scale. The default value is false. - logarithmicScaleBase - an integer representing the base of logarithmic scale. The default value is 10. --- ### Chart Styling Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-styling-and-appearance.htm > Style the jQuery Chart: the jqxChart CSS classes, the theme stylesheets it uses and how to change its appearance. jqxChart offers many options to customize the chart appearance and colors. In this section we will go through the styling options available in different chart elements. #### Series Color Scheme jqxChart ships with eleven built-in color schemes which are used to automatically set colors for different series. You can change the color scheme by setting the colorScheme option of the chart. The available value are from 'scheme01' to 'scheme11'. #### Color Gradients jqxChart uses fill gradients built from the base colors in the color schemes. If you wish to use only basic fill colors you can turn off the gradients at series or seriesGroup level by setting the useGradient property. If the property is not set jqxChart will use gradients by default. ```javascript seriesGroups: [ { type: 'splinearea', useGradient: false, // disable gradient for the entire group valueAxis: { unitInterval: 10, minValue: 0, maxValue: 100, displayValueAxis: false, description: 'Goal in minutes', axisSize: 'auto', tickMarksColor: '#888888' }, series: [ { dataField: 'Goal', displayText: 'Personal Goal', opacity: 0.7 } ] }, { type: 'stackedcolumn', columnsGapPercent: 100, seriesGapPercent: 5, useGradient: false, // disable gradient for the entire group valueAxis: { unitInterval: 10, minValue: 0, maxValue: 100, displayValueAxis: true, description: 'Time in minutes', axisSize: 'auto', tickMarksColor: '#888888', gridLinesColor: '#777777' }, series: [ // override the useGradient property at series level { dataField: 'Running', displayText: 'Running', useGradient: true }, { dataField: 'Swimming', displayText: 'Swimming' }, { dataField: 'Cycling', displayText: 'Cycling' } ] } ] ``` With jqxChart you can define custom Colors for the series by setting their color property. ```javascript seriesGroups: [ { type: 'line', valueAxis: { unitInterval: 500, minValue: 0, maxValue: 3000, displayValueAxis: true, description: 'Daily Closing Price', axisSize: 'auto', tickMarksColor: '#888888' }, series: [ { dataField: 'S&P 500', displayText: 'S&P 500', color: '#ff0000' }, { dataField: 'NASDAQ', displayText: 'NASDAQ', color: '#0000ff' } ] } ] ``` #### Grid lines You can adjust the spacing and colors of the horizontal and vertical grid lines. The vertical gridlines can be adjusted by changing the categoryAxis options. For example the following code makes the vertical grid lines visible, makes their color blue and sets the spacing between the lines such that a line appears once for every tenth element: ```javascript categoryAxis: { gridLinesColor: '#0000FF', showGridLines: true, gridLinesInterval: 10 } ``` The horizontal grid lines can be changed by setting the gridLinesColor, showGridLines and gridLinesInterval options on valueAxis for each seriesGroup. ```javascript valueAxis: { gridLinesColor: '#0000FF', showGridLines: true, gridLinesInterval: 20 } ``` #### Tick marks Tick marks and grid lines work in a very similar way and jqxChart offers identical properties. To change the tick marks across the horizontal axis use the showTickMarks, tickMarksColor and tickMarksInterval options of the Category Axis: ```javascript categoryAxis: { showTickMarks: true, tickMarksColor: '#0000FF', tickMarksInterval: 10 } ``` Similar options are available for the value axis of each series group: ```javascript valueAxis: { showTickMarks: true, tickMarksColor: '#0000FF', tickMarksInterval: 10 } ``` #### Background and border line colors You can also change the chart's border color and background fill by using the 'borderColor' and 'background' properties. Sets the chart's border color. ```javascript // select the chart element and change the default border line color. $('#jqxChart').jqxChart({borderLineColor: 'Blue'}); // refresh the chart element $('#jqxChart').jqxChart('refresh'); ``` Sets the chart's background color. ```javascript // select the chart element and change the default background color. $('#jqxChart').jqxChart({backgroundColor:'Gray'}); // refresh the chart element $('#jqxChart').jqxChart('refresh'); ``` #### Background image Instead of using background color you can use an image: ```javascript // select the chart element and set background image. $('#jqxChart').jqxChart({backgroundImage: '../images/chart_background.jpg'}); // refresh the chart element $('#jqxChart').jqxChart('refresh'); ``` --- ### jQuery Chart API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchart/jquery-chart-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxchart.txt #### Properties - `animationDuration` (Type: Number, Default: 1000): Determines the animations duration in milliseconds. The value must be between 0 and 5000. If it is outside of this range jqxChart will reset it to the default value of 1000. - `borderLineColor` (Type: String, Default: #888888): Sets the chart's border color. - `borderLineWidth` (Type: Number, Default: 1): Sets the chart's border line width - `backgroundColor` (Type: String, Default: White): Sets the chart's background color. - `backgroundImage` (Type: String, Default: ''): Sets the chart's background image. - `colorScheme` (Type: String, Default: 'scheme01'): Sets the chart's color palette. jqxChart supports 11 color schemes from 'scheme01' to 'scheme11'. - `crosshairsDashStyle` (Type: String, Default: '2,2'): Gets or sets the dash style of the crosshairs lines. The style is a series of numbers indicating line length followed by space length. - `crosshairsLineWidth` (Type: Number, Default: 1.0): Gets or sets the width of the crosshairs lines. - `columnSeriesOverlap` (Type: Boolean, Default: false): Enables or disables overlapping of the column series. - `crosshairsColor` (Type: String, Default: #888888): Gets or sets the color of the crosshairs lines. - `draw` (Type: Function, Default: null): Determines the drawing function of jqxChart. When the property is set, you can override the jqxChart's drawing. - `drawBefore` (Type: Function, Default: null): function for custom drawing before the title and other chart elements - `description` (Type: String, Default: ''): Sets the description text of the chart. - `enableCrosshairs` (Type: Boolean, Default: false): Enables or disables the crosshairs lines. The lines are displayed in line and area series when you move over a data point. - `enabled` (Type: Boolean, Default: true): Gets or sets whether the chart widget in enabled or disabled state. - `enableAnimations` (Type: Boolean, Default: true): Determines if the animations are enabled. When you set this property it will turn on or off the animations for all series in all seriesGroups in the chart. - `enableAxisTextAnimation` (Type: Boolean, Default: false): Determines if the animation of the axes text is enabled. - `greyScale` (Type: Boolean, Default: false): Determines whether to display the chart using grey scale colors. - `legendLayout` (Type: Object, Default: null): Sets the legend's layout. The expected object is with the following fields: - `localization` (Type: object, Default: undefined): localization object containing culture specific properties required for formatting currencies, numbers and dates - `padding` (Type: Padding, Default: { left: 5, top: 5, right: 5, bottom: 5 }): Sets the left,top, right & bottom padding of the Chart. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether the Chart's layout is mirrored. - `renderEngine` (Type: String, Default: ''): Determines the rendering engine used to display the chart. Possible values are 'SVG', 'VML' and 'HTML5'. - `seriesGroups` (Type: Object, Default: null): The seriesGroups property is used to describe all series displayed on the chart. jqxChart supports multiple series of different types and series grouping. - `source` (Type: Object, Default: null): Sets the chart's data source. - `showBorderLine` (Type: Boolean, Default: true): Determines whether to display the chart's border line - `showLegend` (Type: Boolean, Default: false): Determines whether to show or hide the chart series legend. - `showToolTips` (Type: Boolean, Default: true): Enables or disables the chart tooltips. - `title` (Type: String, Default: ''): Sets the title of the chart. - `titlePadding` (Type: Padding, Default: { left: 2, top: 2, right: 2, bottom: 2 }): Sets the padding of the chart's title. - `toolTipShowDelay` (Type: Number, Default: 500): Determines the tooltips show delay in milliseconds. Values may range from 0 to 10000 [ms] - `toolTipHideDelay` (Type: Number, Default: 4000): Determines the tooltips hide delay in milliseconds. - `toolTipMoveDuration` (Type: Number, Default: 300): Determines the time in millisecond to move the tooltip between items. - `toolTipFormatFunction` (Type: Function, Default: undefined): User defined tooltips text formatting callback function. - `valueAxis` (Type: Object, Default: null): - visible - shows or hides the valueAxis. - `categoryAxis` (Type: Object, Default: null): Sets or gets the `categoryAxis` property. - `xAxis` (Type: Object, Default: null): Sets the Chart's xAxis. #### Properties - `click` (Arguments: Object): The event is raised when the user clicks on series element. Example: - `mouseover` (Arguments: Object): The event is raised when the user moves the cursor above a series element. Example: - `mouseout` (Arguments: Object): The event is raised when the user moves the cursor out of a series element. Example: - `refreshBegin` (Arguments: Object): The event is raised when the chart begins rendering. - `refreshEnd` (Arguments: Object): The event is raised when the chart finishes rendering. - `rangeSelectionChanged` (Arguments: Object): The event is raised after the chart's range selector position changes and after the chart ends rendering. - `rangeSelectionChanging` (Arguments: Object): The event is raised when the chart's range selector position changes and before the chart starts rendering. - `toggle` (Arguments: Object): The event is raised when a series is toggled by a user click in the chart's legend or through an API call. #### Properties - `addColorScheme` (Arguments: schemeName, array of colors, Return Value: None): Adds a new color scheme. If a scheme with the same name already exists the method will update its colors. - `getItemsCount` (Type: groupIndex, serieIndex, Description: Number): Note: Please, include jqxchart.api.js in order to access this API function. Gets the number of rendered items in a specific series. - `getXAxisValue` (Type: offset, groupIndex, Description: Number): Note: Please, include jqxchart.api.js in order to access this API function. Gets the X Axis's value. - `getValueAxisValue` (Type: offset, groupIndex, Description: Number): Note: Please, include jqxchart.api.js in order to access this API function. Gets the X Axis's value. - `getItemCoord` (Type: groupIndex, serieIndex, itemIndex, Description: object): Note: Please, include jqxchart.api.js in order to access this API function. Gets the rendered coordinates of a data point element. - `getXAxisRect` (Type: groupIndex, Description: {x, y, width, height}): Note: Please, include jqxchart.api.js in order to access this API function. Gets the rendered rectangle coordinates of the x-Axis of specific series group. - `getXAxisLabels` (Type: groupIndex, Description: array): Note: Please, include jqxchart.api.js in order to access this API function. Gets the rendered coordinates and values of the xAxis labels. - `getValueAxisRect` (Type: groupIndex, Description: {x, y, width, height}): Note: Please, include jqxchart.api.js in order to access this API function. Gets the rendered rectangle coordinates of the valueAxis of specific series group. - `getValueAxisLabels` (Type: groupIndex, Description: array): Note: Please, include jqxchart.api.js in order to access this API function. Gets the rendered coordinates and values of the valueAxis labels. - `getColorScheme` (Type: schemeName, Description: array of colors or undefined): Returns the colors of a color scheme by name. If the scheme doesn't exist the method returns undefined. - `hideSerie` (Type: groupIndex, serieIndex, itemIndex, Description: None): Hides a chart series. The result of calling this function is same as the user unchecking the legend box of a chart series. The itemIndex parameter is optional and applicable to pie and donut series only. - `hideToolTip` (Type: hideDelay, Description: None): Note: Please, include jqxchart.api.js in order to access this API function. Hides the current tooltip if visible. - `refresh` (Type: None, Description: None): Refreshes the content of the chart widget after a property or data update. - `removeColorScheme` (Type: schemeName, Description: None): Removes an existing color scheme. If the scheme does not exist the method has no effect. - `saveAsJPEG` (Type: fileName, exportServer, Description: 'chart.jpeg', ''): Exports the chart's content as JPEG image. The browser must support HTML5 Canvas and the device must be able to connect to the export server. If you don't setup your own export server the default server is jqwidgets.com. - `saveAsPNG` (Type: fileName, exportServer, Description: 'chart.png', ''): Exports the chart's content as PNG image. The browser must support HTML5 Canvas and the device must be able to connect to the export server. If you don't setup your own export server the default server is jqwidgets.com. - `saveAsPDF` (Type: fileName, exportServer, Description: 'chart.pdf', ''): Exports the chart's content as PDF. The browser must support HTML5 Canvas and the device must be able to connect to the export server. If you don't setup your own export server the default server is jqwidgets.com. - `showSerie` (Type: groupIndex, serieIndex, itemIndex, Description: None): Shows a hidden chart series. The result of calling this function is same as the user checking the legend box of a chart series. The itemIndex parameter is optional and applicable to pie and donut series only. - `showToolTip` (Type: groupIndex, serieIndex, itemIndex, showDelay, hideDelay, Description: None): Note: Please, include jqxchart.api.js in order to access this API function. Shows a the tooltip for a particular data point. - `update` (Type: None, Description: None): Updates the values of the chart series without full refresh of the entire chart. The method should be used for animation of frequently changing values. See the live updates example in the product demo. --- ### jQuery Chat API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxchat/jqxchat-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxchat.txt #### Properties - `accentColor` (Type: string, Default: null): Sets or gets the brand accent colour used for the send button, the user message bubbles, the avatars and the popup launcher. Accepts any CSS colour. When null, the default indigo accent is used. - `apiKey` (Type: string, Default: ''): Sets or gets the platform key used to authenticate requests to the AI provider. **Security note:** a key set here is used to call the provider directly from the browser and is therefore exposed - this is intended for local trials only. - `botAvatar` (Type: string, Default: null): Sets or gets the assistant avatar image. Accepts any image URL or data-URI. When null, a themed circle with the first letter of `botName` is shown. - `botName` (Type: string, Default: 'Assistant'): Sets or gets the display name of the assistant, shown in the message meta and used for the assistant avatar initial. - `colorScheme` (Type: string, Default: 'auto'): Sets or gets the colour scheme of the chat. Possible values: 'auto' (follow the operating system preference), 'light' and 'dark'. The scheme is applied independently of the jqWidgets theme. - `disabled` (Type: boolean, Default: false): Sets or gets whether the chat is disabled. When disabled, the input and send button are inactive. - `enableClear` (Type: boolean, Default: true): Sets or gets whether the header shows the 'New chat' action button that clears the conversation. - `enableCopyCode` (Type: boolean, Default: true): Sets or gets whether a 'Copy' button is shown on fenced code blocks in assistant messages. - `enableStop` (Type: boolean, Default: true): Sets or gets whether the send button turns into a 'Stop' button while the assistant is generating a response. When stopped, any text streamed so far is preserved. - `headers` (Type: object, Default: null): Sets or gets an object of additional HTTP headers merged into the outgoing request to the provider or proxy. - `height` (Type: number, Default: 580): Sets or gets the chat's height. - `launcherIcon` (Type: string, Default: null): Sets or gets custom HTML/SVG markup for the popup launcher button. Applies only when `mode` is 'popup'. When null, a default chat-bubble icon is used. - `launcherPosition` (Type: string, Default: 'bottom-right'): Sets or gets the screen corner of the popup launcher button and panel. Possible values: 'bottom-right' and 'bottom-left'. Applies only when `mode` is 'popup'. - `maxTokens` (Type: number, Default: 1024): Sets or gets the upper bound on the number of tokens in the assistant's response, sent to the provider as max_tokens. - `messages` (Type: array, Default: []): Sets or gets the conversation as an array of message objects of the form `{ role: 'user' | 'assistant', content: string }`. Setting this property replaces the current conversation. - `mode` (Type: string, Default: 'inline'): Sets or gets the display mode. Possible values: 'inline' (the chat is an embedded panel) and 'popup' (a floating launcher button in the page corner opens the chat panel). - `model` (Type: string, Default: null): Sets or gets the model identifier sent to the provider. When null, a per-provider default is used ('claude-opus-4-8' for anthropic, 'gpt-4o-mini' for openai). - `open` (Type: boolean, Default: false): Sets or gets whether the popup panel is open. Applies only when `mode` is 'popup'. Setting it to true opens the panel and hides the launcher; false collapses back to the launcher. - `placeHolder` (Type: string, Default: 'Message the assistant...'): Sets or gets the placeholder text shown in the message input. - `provider` (Type: string, Default: 'anthropic'): Sets or gets the AI provider adapter. Possible values: 'anthropic' (Anthropic Claude), 'openai' (OpenAI) and 'custom'. - `proxyUrl` (Type: string, Default: null): Sets or gets a URL to POST the request to instead of calling the provider directly. - `rtl` (Type: boolean, Default: false): Sets or gets a value indicating whether the widget's layout is aligned to support locales using right-to-left fonts. - `sendButtonIcon` (Type: boolean, Default: true): Sets or gets whether the send button is rendered as a circular icon (true) or as a text label using `sendButtonLabel` (false). - `sendButtonLabel` (Type: string, Default: 'Send'): Sets or gets the text label of the send button when `sendButtonIcon` is false. Also used as the button's tooltip. - `sendRequest` (Type: any, Default: null): Sets or gets a callback that fully controls transport: `function(payload, widget)`. - `showAvatars` (Type: boolean, Default: true): Sets or gets whether avatars are shown next to messages. - `showHeader` (Type: boolean, Default: true): Sets or gets whether the header (avatar, title, status and actions) is shown. - `showHeaderAvatar` (Type: boolean, Default: true): Sets or gets whether the assistant avatar is shown in the header. - `showTimestamps` (Type: boolean, Default: true): Sets or gets whether a timestamp is shown in each message's meta line. - `starterPrompts` (Type: array, Default: []): Sets or gets an array of suggested prompt strings displayed as clickable chips when the conversation is empty. Clicking a chip sends that prompt. - `statusText` (Type: string, Default: 'Online'): Sets or gets the status label shown under the title next to a status dot. When null, the status is hidden. When `subtitle` is set, the subtitle text takes precedence. - `stream` (Type: boolean, Default: true): Sets or gets whether the assistant response is streamed token by token using Server-Sent Events. When false, the full response is requested and rendered at once. - `subtitle` (Type: string, Default: null): Sets or gets the header subtitle text shown under the title. When set, it takes precedence over `statusText`. - `system` (Type: string, Default: 'You are a helpful assistant embedded in a web application.'): Sets or gets the system / developer instructions sent to the model to define the assistant's behaviour. - `theme` (Type: string, Default: ''): Sets the widget's theme. - `title` (Type: string, Default: 'AI Assistant'): Sets or gets the header title text (also used as the popup launcher tooltip). - `typingIndicator` (Type: boolean, Default: true): Sets or gets whether an animated typing indicator is shown while the assistant is generating a response. - `userAvatar` (Type: string, Default: null): Sets or gets the user avatar image. Accepts any image URL or data-URI. When null, a themed circle with the first letter of `userName` is shown. - `userName` (Type: string, Default: 'You'): Sets or gets the display name of the user, shown in the message meta and used for the user avatar initial. - `welcomeMessage` (Type: string, Default: null): Sets or gets the welcome text (Markdown supported) shown in the empty state above the starter prompts. - `width` (Type: number, Default: 400): Sets or gets the chat's width. #### Events - `messageSent` (Type: Event): This event is triggered when the user sends a message. The event argument contains `args.role` ('user') and `args.content` (the message text). - `responseStart` (Type: Event): This event is triggered when a request to the AI provider begins, before any tokens arrive. - `responseDelta` (Type: Event): This event is triggered for each streamed chunk of the assistant's response. The event argument contains `args.delta` (the new text) and `args.content` (the accumulated text so far). - `messageReceived` (Type: Event): This event is triggered when the assistant's response is complete. The event argument contains `args.role` ('assistant') and `args.content` (the full response text). - `responseEnd` (Type: Event): This event is triggered after a response finishes, alongside `messageReceived`. The event argument contains `args.content` (the full response text). - `error` (Type: Event): This event is triggered when a request fails or the connection is misconfigured. The event argument contains `args.error` (the error object) and `args.message` (the error text). - `open` (Type: Event): This event is triggered when the popup panel is opened. Applies only when `mode` is 'popup'. - `close` (Type: Event): This event is triggered when the popup panel is closed. Applies only when `mode` is 'popup'. - `stop` (Type: Event): This event is triggered when the user stops an in-progress generation via the stop button or the `stop` method. - `create` (Type: Event): This event is triggered when the widget is created and rendered. #### Methods - `sendMessage` (Type: Method): Sends a message to the assistant. When `text` is omitted, the current input value is used. Adds the message to the conversation and requests a response from the provider. - `stop` (Type: Method): Stops the in-progress generation. Any text streamed so far is kept in the conversation and the `stop` event is raised. - `addMessage` (Type: Method): Appends a message to the conversation and the view without contacting the provider. - `appendDelta` (Type: Method): Appends a chunk of streamed text into the current assistant bubble. Intended for use inside a `sendRequest` callback that drives streaming manually. Late chunks are ignored after a stop. - `getMessages` (Type: Method): Returns a copy of the conversation history as an array of message objects. - `clearConversation` (Type: Method): Clears the conversation and restores the empty state (welcome message and starter prompts). - `focus` (Type: Method): Moves keyboard focus to the message input. In popup mode, focus is applied only when the panel is open. - `openPopup` (Type: Method): Opens the popup panel and hides the launcher. Applies only when `mode` is 'popup'. - `closePopup` (Type: Method): Closes the popup panel and shows the launcher. Applies only when `mode` is 'popup'. - `toggle` (Type: Method): Toggles the popup panel open or closed. Applies only when `mode` is 'popup'. - `val` (Type: Method): Returns the conversation history as an array of message objects (alias of getMessages). - `render` (Type: Method): Renders the widget. - `refresh` (Type: Method): Refreshes the widget's layout (re-measures and re-sizes the message area). - `destroy` (Type: Method): Destroys the widget and removes it (and the popup launcher, if any) from the DOM. --- ### Getting started with the jQuery PickList Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxpicklist/jquery-picklist-getting-started.htm > jQuery PickList getting started: install jQWidgets, add jqxPickList to your app, see a complete example, then handle its events and call its methods. jqxPickList is a dual-list picker, also called a shuttle or transfer list: the available items on the left, the selected items on the right, and buttons, a double-click or the keyboard to move items across. Use it to pick a subset from a set, such as the columns of a report or the members of a team. Both lists are jqxListBox instances, so filtering, checkboxes and item templates work in the pick list too. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `5` scripts, listed below - **Demos:** [jQuery PickList demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxpicklist/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxpicklist/jquery-picklist-api.htm) jqxPickList in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxpicklist/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the PickList's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#pickList').jqxPickList({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxpicklist/index.htm) show every option with its source code; the guide below explains them. #### Create a PickList Add an element for the widget: ```html
``` Then create the widget on it. `source` is the pool of items, and `selectedItems` lists the ones that start in the selected list: ```javascript $('#pickList').jqxPickList({ width: 620, height: 340, source: ['Order ID', 'Customer', 'Company', 'Country', 'Product', 'Quantity', 'Total', 'Order date'], selectedItems: ['Order ID', 'Customer', 'Total'], sourceHeader: 'Available columns', targetHeader: 'Report columns' }); ``` #### Items as objects With an array of objects, `displayMember` names the field shown as the item's label and `valueMember` the field that identifies it. `selectedItems` then lists values: ```javascript $('#pickList').jqxPickList({ source: [ { id: 1, name: 'Anna Smith' }, { id: 2, name: 'Peter Brown' }, { id: 3, name: 'Maria Garcia' } ], displayMember: 'name', valueMember: 'id', selectedItems: [2], filterable: true, showCounts: true }); ``` `source` also accepts a `jqx.dataAdapter` instance. #### Set and get options Pass an object to change options after the widget is created, and an option's name to read it: ```javascript $('#pickList').jqxPickList({ checkboxes: true, reorderable: true }); const header = $('#pickList').jqxPickList('targetHeader'); ``` `checkboxes` selects items with check boxes; `reorderable` adds move up and move down buttons to the selected list. #### Handle events `change` is raised whenever items move between the lists. Its `event.args` carries `added`, `removed` and the new `selectedItems`: ```javascript $('#pickList').on('change', function (event) { console.log(event.args.added, event.args.removed, event.args.selectedItems); }); ``` `itemsAdded` and `itemsRemoved` are raised for each transfer, and `reordered` when the selected list is rearranged; each carries the items it concerns in `event.args.items`. #### Call methods Call a method by passing its name, followed by its arguments: ```javascript // the items in the selected list, in order const items = $('#pickList').jqxPickList('getSelectedItems'); // move values across (one value or an array) $('#pickList').jqxPickList('add', ['Product', 'Quantity']); $('#pickList').jqxPickList('remove', 'Customer'); // read or replace the selection by value const values = $('#pickList').jqxPickList('val'); $('#pickList').jqxPickList('val', ['Order ID', 'Total']); ``` `addAll` and `removeAll` move every item, and `getSource` returns the items left in the available list. #### Next steps - [PickList API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxpicklist/jquery-picklist-api.htm): every property, event and method. - [jQuery PickList demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxpicklist/index.htm): live examples with their source code. --- ### jQuery PickList API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxpicklist/jquery-picklist-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxpicklist.txt #### Properties - `width` (Type: string | number, Default: 560): Sets or gets the width of the widget. - `height` (Type: string | number, Default: 340): Sets or gets the height of the widget. - `source` (Type: Array | Object, Default: null): Sets or gets the pool of available items. Accepts an array of strings, an array of objects, or a jqxDataAdapter instance. - `selectedItems` (Type: Array, Default: []): Sets or gets the values that start in the Selected list. Values are matched against valueMember. - `displayMember` (Type: string, Default: ""): Sets or gets the field of a source object used as the item label. - `valueMember` (Type: string, Default: ""): Sets or gets the field of a source object used as the item value. - `sourceHeader` (Type: string, Default: "Available"): Sets or gets the header text of the available list. Set to null to hide the header row. - `targetHeader` (Type: string, Default: "Selected"): Sets or gets the header text of the selected list. Set to null to hide the header row. - `showCounts` (Type: boolean, Default: true): Sets or gets whether item counts are shown in the list headers. - `filterable` (Type: boolean, Default: false): Sets or gets whether a search box is displayed above each list. - `filterPlaceHolder` (Type: string, Default: "Filter..."): Sets or gets the placeholder text of the search boxes. - `searchMode` (Type: string, Default: "containsignorecase"): Sets or gets how the search boxes match items. - `checkboxes` (Type: boolean, Default: false): Sets or gets whether items are selected with checkboxes. - `reorderable` (Type: boolean, Default: false): Sets or gets whether the selected list can be reordered. Adds move up and move down buttons. - `renderer` (Type: Function, Default: null): Sets or gets a custom item template. The function returns the HTML rendered for an item. - `buttons` (Type: Array, Default: ['add', 'addAll', 'remove', 'removeAll']): Sets or gets which transfer buttons are rendered. Valid entries are add, addAll, remove and removeAll. - `itemHeight` (Type: number, Default: 26): Sets or gets the height of an item, in pixels. - `sourceLabel` (Type: string, Default: "Available items"): Sets or gets the accessible name of the available list. - `targetLabel` (Type: string, Default: "Selected items"): Sets or gets the accessible name of the selected list. - `disabled` (Type: boolean, Default: false): Sets or gets whether the widget is disabled. - `rtl` (Type: boolean, Default: false): Sets or gets whether the widget is displayed right-to-left. - `theme` (Type: string, Default: ''): Sets or gets the theme of the widget. #### Events - `create` (Type: Event): This event is triggered when the widget is created. - `change` (Type: Event): This event is triggered when the selected items change. The event argument carries added, removed and selectedItems. - `itemsAdded` (Type: Event): This event is triggered when items are moved into the selected list. The event argument carries items. - `itemsRemoved` (Type: Event): This event is triggered when items are moved out of the selected list. The event argument carries items. - `reordered` (Type: Event): This event is triggered when the selected list is reordered. The event argument carries items. #### Methods - `getSelectedItems` (Type: Method): Returns the items currently in the selected list, in order. - `getSelectedValues` (Type: Method): Returns the values currently in the selected list, in order. - `getSource` (Type: Method): Returns the items remaining in the available list. - `add` (Type: Method): Moves one or more values into the selected list. - `remove` (Type: Method): Moves one or more values out of the selected list. - `addAll` (Type: Method): Moves every available item into the selected list. - `removeAll` (Type: Method): Moves every selected item back into the available list. - `moveUp` (Type: Method): Moves the highlighted items one position up in the selected list. Requires reorderable. - `moveDown` (Type: Method): Moves the highlighted items one position down in the selected list. Requires reorderable. - `val` (Type: Method): Gets the selected values, or sets them when an array is passed. - `focus` (Type: Method): Focuses the available list. - `refresh` (Type: Method): Refreshes the widget. - `render` (Type: Method): Renders the widget. - `destroy` (Type: Method): Destroys the widget and removes it from the DOM. --- ### jQuery CheckBox Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcheckandradio/jquery-checkbox-getting-started.htm > jQuery CheckBox getting started: install jQWidgets, add jqxCheckBox to your app, see a complete example, then handle its events and call its methods. The jqxCheckBox widget displays a check box that allows the end-user to select a true, false or indeterminate condition. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxCheckBox widget requires the following files: ```html ``` The next step is to create a div element or input element with type attribute set to "checkbox" within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```javascript $("#jqxcheckbox").jqxCheckBox({ width: 120, height: 25 }); ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxCheckBox’s constructor. ```javascript $("#jqxcheckbox").jqxCheckBox(‘check’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxCheckBox's constructor. ```javascript $("#jqxcheckbox").jqxCheckBox({ checked: true }); ``` To get a property(option), you need to pass the property name to the jqxCheckBox's constructor. ```javascript const checked = $("#jqxcheckbox").jqxCheckBox('checked'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the CheckBox's state after the user clicks it. The example code below demonstrates how to bind to the ‘change’ event of jqxCheckBox. ```javascript $("#jqxcheckbox").on('change', function (event) { const checked = event.args.checked; alert('checked: ' + checked); }); ``` #### Basic Sample ```html jQuery CheckBox Sample
Click me
``` --- ### jQuery CheckBox Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcheckandradio/jquery-checkbox-styling-and-appearance.htm > Style the jQuery CheckBox: the jqxCheckBox CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxButtons. - jqxCheckBox Style - jqx-widget - applied to jqxCheckBox widget. - jqx-checkbox - applied to jqxCheckBox's outer div element. - jqx-checkbox-default - applied to the check box when its state is default. - jqx-fill-state-normal - applied to the check box when its state is default. - jqx-checkbox-hover - applied to the check box when the mouse cursor is over it - jqx-fill-state-hover - applied to the check box when the mouse cursor is over it - jqx-checkbox-disabled -applied to the check box when the widget is disabled - jqx-checkbox-disabled-box - applied to the check's box when the jqxCheckBox is disabled. - jqx-checkbox-check-checked - applied to the check's box when the jqxCheckBox is checked. Displays a check icon - jqx-checkbox-check-disabled - applied to the check's box when the jqxCheckBox is disabled. Displays a disabled check icon - jqx-checkbox-check-indeterminate - applied to the check's box when the jqxCheckBox is in indeterminate state. Displays a rectangle inside the check's box. - jqx-checkbox-check-indeterminate-disabled - applied to the check's box when the jqxCheckBox is in indeterminate state and the jqxCheckBox is disabled. Displays a gray(disabled) rectangle inside the check's box. - jqx-fill-state-disabled - applied to the jqxCheckBox when it is disabled. - jqx-fill-state-focus - applied to the jqxCheckBox when it is focused. When you create a custom style with colors and backgrounds for jqxCheckBox, you need to do the following: - Add the above CSS classes related to jqxButtons - After each CSS class, add your theme name. For example: jqx-checkbox-shinyblack - To apply your custom style to jqxCheckBox, you need to set its 'theme' property(option) to point to your theme name string. ```javascript $("#jqxcheckbox").jqxCheckBox({ theme: 'shinyblack', width: 120, height: 25 }); ``` - The sample below demonstrates how to set the 'Shiny Black' theme to jqxCheckBox. ```html jQuery CheckBox CSS Styling Sample
Click me
``` --- ### jQuery CheckBox API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcheckandradio/jquery-checkandradio-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxcheckandradio.txt #### Properties - `animationShowDelay` (Type: Number, Default: 250): Sets or gets the delay of the fade animation when the CheckBox is going to be checked. - `animationHideDelay` (Type: Number, Default: 300): Sets or gets the delay of the fade animation when the CheckBox is going to be unchecked. - `boxSize` (Type: String, Default: "13px"): Sets or gets the checkbox's size. - `checked` (Type: Boolean, Default: false): Sets or gets the check state. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the CheckBox is disabled. - `enableContainerClick` (Type: Boolean, Default: true): Sets or gets whether the clicks on the container are handled as clicks on the check box. - `groupName` (Type: String, Default: ""): Sets or gets the group name. When this property is set, the checkboxes in the same group behave as radio buttons. - `height` (Type: Number/String, Default: null): Sets or gets the jqxCheckBox's height. - `hasThreeStates` (Type: Boolean, Default: false): Sets or gets whether the checkbox has 3 states - checked, unchecked and indeterminate. - `locked` (Type: Boolean, Default: false): Sets or gets whether the checkbox is locked. In this mode the user is not allowed to check/uncheck the checkbox. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `width` (Type: Number/String, Default: null): Sets or gets the jqxCheckBox's width. #### Events - `checked` (Type: Event): This event is triggered when the checkbox is checked. - `change` (Type: Event): This is triggered when the checkbox's state changes from one state to another. - `indeterminate` (Type: Event): This event is triggered when the checkbox's checked property is going to be null. - `unchecked` (Type: Event): This event is triggered when the checkbox is unchecked. #### Methods - `check` (Type: Method): Checks the checkbox. - `disable` (Type: Method): Disables the checkbox. - `destroy` (Type: Method): Destroys the widget. - `enable` (Type: Method): Enables the checkbox. - `focus` (Type: Method): Focuses the widget. - `indeterminate` (Type: Method): Sets the indeterminate state(checked property value is going to be null after calling this method). - `render` (Type: Method): Renders the widget. - `toggle` (Type: Method): Toggles the check state. This method is automatically called when the user clicks the checkbox. - `uncheck` (Type: Method): Unchecks the checkbox. - `val` (Type: Method): Sets or gets the value. --- ### jQuery CheckBoxGroup Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcheckboxgroup/jqxcheckboxgroup-getting-started.htm > jQuery CheckBoxGroup getting started: install jQWidgets, add jqxCheckBoxGroup to your app, see a complete example, then handle its events and call its methods. jqxCheckBoxGroup represents a widget which displays a group of checkboxes and has API to customize them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the JavaScript files and CSS dependencies to your project. The jqxCheckBoxGroup widget requires the following files: ```html ``` The next step is to create html element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function (method), you need to pass the method name and parameters (if any) in the jqxCheckBoxGroup's constructor. ```javascript $("#jqxCheckBoxGroup").jqxCheckBoxGroup('value'); ``` To set a property (option), you need to pass the property name and value(s) in the jqxCheckBoxGroup's constructor. ```javascript $("#jqxRadioButtonGroup").jqxRadioButtonGroup({ value: 'example' }); ``` To get a property (option), you need to pass the property name to the jqxCheckBoxGroup's constructor. ```javascript const value = $("#jqxCheckBoxGroup").jqxCheckBoxGroup('value'); ``` To bind to an event of a UI widget, you can use basic Javascript syntax. Let’s suppose that you want to get the selected value after the user change the current one. The example code below demonstrates how to bind to the ‘resize’ event of jqxCheckBoxGroup. ```javascript $("#jqxRadioButtonGroup").on(‘change’, function (event) { }); ``` #### Basic jqxCheckBoxGroup Sample ```html jqxRadioButtonGroup basic demo.
https://www.jqwidgets.com/
``` --- ### jQuery CheckBoxGroup API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcheckboxgroup/jqxcheckboxgroup-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxcheckboxgroup.txt #### Properties - `change` (Type: boolean): Sets or gets the change function. It is called when a value is changed and the changed item is passed as parameter. - `disabled` (Type: boolean, Default: false): Sets or gets whether the CheckBoxGroup is disabled. - `items` (Type: [], Default: []): Sets or gets the items. Each item could be a string or an object. The object has the following properties: enabled: boolean, encode: boolean, label: string, value: string, cssClass: string and checked: boolean. - `value` (Type: [], Default: []): Sets or gets the value array. This property determines the checked item(s). - `layout` (Type: string, Default: vertical): Sets or gets the items layout. It can be 'horizontal' or 'vertical'. - `labelPosition` (Type: string, Default: after): Sets or gets the items label position. It can be 'before' or 'after'. - `rtl` (Type: boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `theme` (Type: string, Default: ''): Sets the widget's theme. #### Methods - `getValue` (Type: Method): Gets the value. - `getValueAt` (Type: Method): Gets an item value at index. - `enableAt` (Type: Method): Enables an item at index. - `disableAt` (Type: Method): Disables an item at index. - `checkAt` (Type: Method): Checks an item at index. - `uncheckAt` (Type: Method): Unchecks an item at index. - `uncheckAll` (Type: Method): Unchecks all items. - `checkAll` (Type: Method): Checks all items. - `checkValue` (Type: Method): Checks an item by value. - `uncheckValue` (Type: Method): Unchecks an item by value. - `disable` (Type: Method): Disables the CheckBoxGroup. - `destroy` (Type: Method): Destroys the widget. - `enable` (Type: Method): Enables the CheckBoxGroup. - `render` (Type: Method): Renders the widget. - `val` (Type: Method): Sets or gets the value. --- ### jQuery RadioButtonGroup Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxradiobuttongroup/jqxradiobuttongroup-getting-started.htm > jQuery RadioButtonGroup getting started: install jQWidgets, add jqxRadioButtonGroup to your app, see a complete example, then handle its events and call its… jqxRadioButtonGroup represents a widget which displays a group of radio button and has API to customize them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the JavaScript files and CSS dependencies to your project. The jqxRadioButtonGroup widget requires the following files: ```html ``` The next step is to create html element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function (method), you need to pass the method name and parameters (if any) in the jqxRadioButtonGroup's constructor. ```javascript $("#jqxRadioButtonGroup").jqxRadioButtonGroup('value'); ``` To set a property (option), you need to pass the property name and value(s) in the jqxRadioButtonGroup's constructor. ```javascript $("#jqxRadioButtonGroup").jqxRadioButtonGroup({ value: 'example' }); ``` To get a property (option), you need to pass the property name to the jqxRadioButtonGroup's constructor. ```javascript const value = $("#jqxRadioButtonGroup").jqxRadioButtonGroup('value'); ``` To bind to an event of a UI widget, you can use basic Javascript syntax. Let’s suppose that you want to get the selected value after the user change the current one. The example code below demonstrates how to bind to the ‘resize’ event of jqxRadioButtonGroup. ```javascript $("#jqxRadioButtonGroup").on(‘change’, function (event) { }); ``` #### Basic jqxRadioButtonGroup Sample ```html jqxRadioButtonGroup basic demo.
https://www.jqwidgets.com/
``` --- ### jQuery RadioButtonGroup API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxradiobuttongroup/jqxradiobuttongroup-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxradiobuttongroup.txt #### Properties - `change` (Type: boolean): Sets or gets the change function. It is called when a value is changed and the changed item is passed as parameter. - `disabled` (Type: boolean, Default: false): Sets or gets whether the CheckBoxGroup is disabled. - `items` (Type: [], Default: []): Sets or gets the items. Each item could be a string or an object. The object has the following properties: enabled: boolean, encode: boolean, label: string, value: string, cssClass: string and checked: boolean. - `value` (Type: [], Default: []): Sets or gets the value array. This property determines the checked item(s). - `layout` (Type: string, Default: vertical): Sets or gets the items layout. It can be 'horizontal' or 'vertical'. - `labelPosition` (Type: string, Default: after): Sets or gets the items label position. It can be 'before' or 'after'. - `rtl` (Type: boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `theme` (Type: string, Default: ''): Sets the widget's theme. #### Methods - `getValue` (Type: Method): Gets the value. - `getValueAt` (Type: Method): Gets an item value at index. - `enableAt` (Type: Method): Enables an item at index. - `disableAt` (Type: Method): Disables an item at index. - `checkAt` (Type: Method): Checks an item at index. - `uncheckAt` (Type: Method): Unchecks an item at index. - `uncheckAll` (Type: Method): Unchecks all items. - `checkValue` (Type: Method): Checks an item by value. - `uncheckValue` (Type: Method): Unchecks an item by value. - `disable` (Type: Method): Disables the CheckBoxGroup. - `destroy` (Type: Method): Destroys the widget. - `enable` (Type: Method): Enables the CheckBoxGroup. - `render` (Type: Method): Renders the widget. - `val` (Type: Method): Sets or gets the value. --- ### jQuery ColorPicker Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcolorpicker/jquery-colorpicker-getting-started.htm > jQuery ColorPicker getting started: install jQWidgets, add jqxColorPicker to your app, see a complete example, then handle its events and call its methods. jqxColorPicker is a JavaScript UI widget that allows you to easily pick a color. You can configure the jqxColorPicker's color mode, input a color in hex or rgb format. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `6` scripts, listed below - **Demos:** [jQuery ColorPicker demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcolorpicker/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcolorpicker/jquery-colorpicker-api.htm) jqxColorPicker in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcolorpicker/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the ColorPicker's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#colorPicker').jqxColorPicker({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcolorpicker/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxColorPicker widget requires the following files: ```html ``` The next step is to create a DIV element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxColorPicker’s constructor. ```javascript $("#jqxColorPicker").jqxColorPicker(‘setColor’, '#ff00ff'); ``` To get the result of a function(method) call, you need to pass the method name in the jqxColorPicker’s constructor and parameters(if any). ```javascript var color = $("#jqxColorPicker").jqxColorPicker(‘getColor’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxColorPicker's constructor. ```javascript $("#jqxColorPicker").jqxColorPicker({ disabled: true }); ``` To get a property(option), you need to pass the property name to the jqxColorPicker's constructor. ```javascript const isDisabled = $("#jqxColorPicker").jqxColorPicker('disabled'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the color is changed.. The example code below demonstrates how to bind to the ‘colorchange’ event of jqxColorPicker. ```javascript $("#jqxColorPicker").on('colorchange', function (event) { }); ``` #### Basic Sample ```html jQuery Color Picker Sample
``` --- ### jQuery ColorPicker API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcolorpicker/jquery-colorpicker-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxcolorpicker.txt #### Properties - `color` (Type: String, Default: '#ff0000'): Sets or gets the `color` property. - `colorMode` (Type: String, Default: 'saturation'): Sets or gets the color mode. - `disabled` (Type: Boolean, Default: false): Enables or disables the color picker. - `height` (Type: Number/String, Default: null): Sets or gets the height of the color picker. - `showTransparent` (Type: Boolean, Default: false): Sets or gets the showTransparent property. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `width` (Type: Number/String, Default: null): Sets or gets the width of the color picker. #### Events - `colorchange` (Type: Event): This event is triggered when a new color is picked. #### Methods - `getColor` (Type: Method): Gets the color. - `setColor` (Type: Method): Sets a color. --- ### jQuery ComboBox Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcombobox/jquery-combobox-getting-started.htm > jQuery ComboBox getting started: install jQWidgets, add jqxComboBox to your app, see a complete example, then handle its events and call its methods. jqxComboBox represents a jQuery combobox widget that contains an input field with auto-complete functionality and a list of selectable items displayed in a drop-down. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `7` scripts, listed below - **Demos:** [jQuery ComboBox demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcombobox/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcombobox/jquery-combobox-api.htm) jqxComboBox in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcombobox/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the ComboBox's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#comboBox').jqxComboBox({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcombobox/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxComboBox widget requires the following files: ```html ``` The next step is to create a div element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```javascript const source = [ "Instant coffee", "Irish coffee", "Liqueur coffee"]; // Create a jqxComboBox $("#jqxcombobox").jqxComboBox({ source: source, width: '200px', height: '25px' }); ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxComboBox’s constructor. ```javascript $("#jqxcombobox").jqxComboBox(‘selectIndex’, 1); ``` To get the result of a function(method) call, you need to pass the method name in the jqxComboBox’s constructor. ```javascript $("#jqxcombobox").jqxComboBox(‘getSelectedIndex’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxComboBox's constructor. ```javascript $("#jqxcombobox").jqxComboBox({ selectedIndex: 2 }); ``` To get a property(option), you need to pass the property name to the jqxComboBox's constructor. ```javascript const index = $("#jqxcombobox").jqxComboBox('selectedIndex'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the selected item when the user clicks. The example code below demonstrates how to bind to the ‘select’ event of jqxComboBox. ```javascript $('#jqxComboBox').on('select', function (event) { const args = event.args; const item = $('#jqxComboBox').jqxComboBox('getItem', args.index); }); ``` #### Basic Sample ```html jQuery ComboBox
``` --- ### jQuery ComboBox Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcombobox/jquery-combobox-styling-and-appearance.htm > Style the jQuery ComboBox: the jqxComboBox CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxComboBox. - jqx-widget - applied to the jqxComboBox widget. - jqx-combobox-content - applied to the jqxComboBox's content which displays the text. - jqx-widget-content - applied to the jqxComboBox's content which displays the text. - jqx-combobox-input - applied to the ComboBox's input field. - jqx-combobox-content-disabled - applied to the ComboBox's content when the widget is disabled. - jqx-combobox-arrow-normal - applied to the ComboBox's arrow button. - jqx-combobox-arrow-hover - applied to the ComboBox's arrow button when the mouse is over the button. - jqx-combobox-arrow-selected - applied to the ComboBox's arrow button when the ComboBox's popup is opened. - jqx-combobox-state-normal - applied to the ComboBox in normal state. - jqx-fill-state-normal - applied to the ComboBox in normal state. - jqx-combobox-state-hover - applied to the ComboBox when the mouse is over the widget. - jqx-fill-state-hover - applied to the ComboBox when the mouse is over the widget. - jqx-combobox-state-selected - applied to the ComboBox when the popup ListBox is shown. - jqx-fill-state-pressed - applied to the ComboBox when the popup ListBox is shown. - jqx-fill-state-focus - applied to the combobox when it is focused. - jqx-fill-state-disabled - applied to the combobox when it is disabled. *jqxComboBox internally use the jqxListBox widget. For additional information about styling jqxListBox, please take a look at the jqxListBox's Styling and Appearance help topic. When you create a custom style with colors and backgrounds for jqxComboBox, you need to do the following: - Add the above CSS classes related to jqxComboBox - After each CSS class, add your theme name. For example: jqx-combobox-summer - To apply your custom style to jqxComboBox, you need to set its 'theme' property(option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Summer' theme to jqxComboBox. ```html jQuery ComboBox CSS Styling and Appearance
``` --- ### jQuery ComboBox API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcombobox/jquery-combobox-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxcombobox.txt #### Properties - `animationType` (Type: String, Default: 'slide'): Sets the type of the animation. - `autoComplete` (Type: Boolean, Default: false): Sets or gets the whether the 'autoComplete' feature is enabled or disabled. When this feature is enabled, the jqxComboBox displays in the popup listbox, only the items that match the searched text. - `autoOpen` (Type: Boolean, Default: false): Sets or gets whether the DropDown is automatically opened when the mouse cursor is moved over the widget. - `autoItemsHeight` (Type: Boolean, Default: false): Sets or gets whether items will wrap when they reach the width of the dropDown. - `autoDropDownHeight` (Type: Boolean, Default: false): Sets or gets whether the height of the jqxComboBox's ListBox displayed in the widget's DropDown is calculated as a sum of the items heights. - `closeDelay` (Type: Number, Default: 400): Sets the delay of the 'close' animation. - `checkboxes` (Type: Boolean, Default: false): Determines whether checkboxes will be displayed next to the list items. (The feature requires jqxcheckbox.js) - `disabled` (Type: Boolean, Default: false): Enables/disables the jqxComboBox. - `displayMember` (Type: String, Default: ""): Sets or gets the displayMember of the Items. The displayMember specifies the name of an object property to display. The name is contained in the collection specified by the 'source' property. - `dropDownHorizontalAlignment` (Type: String, Default: 'left'): Sets or gets the DropDown's alignment. - `dropDownVerticalAlignment` (Type: String, Default: 'bottom'): Sets or gets the DropDown's alignment. - `dropDownHeight` (Type: Number, Default: 200): Sets or gets the height of the jqxComboBox's ListBox displayed in the widget's DropDown. - `dropDownWidth` (Type: Number, Default: 200): Sets or gets the width of the jqxComboBox's ListBox displayed in the widget's DropDown. - `enableHover` (Type: Boolean, Default: true): Enables/disables the hover state. - `enableSelection` (Type: Boolean, Default: true): Enables/disables the selection. - `enableBrowserBoundsDetection` (Type: Boolean, Default: false): Sets or gets whether the dropdown detects the browser window's bounds and automatically adjusts the dropdown's position. - `height` (Type: Number/String, Default: null): Sets or gets the jqxComboBox height. - `itemHeight` (Type: Number, Default: -1): Sets or gets the height of the jqxComboBox Items. When the itemHeight == - 1, each item's height is equal to its desired height. - `multiSelect` (Type: Boolean, Default: false): Determines whether the jqxComboBox is in multi-select mode. - `minLength` (Type: Number, Default: 2): Determines the minimum number of characters that need to be entered by the user for search in remote data source when remoteAutoComplete property is set to true. - `openDelay` (Type: Number, Default: 350): Sets or gets the delay of the 'open' animation. - `popupZIndex` (Type: Number, Default: 20000): Sets or gets the popup's z-index. - `placeHolder` (Type: String, Default: ""): Sets or gets the input field's place holder. - `remoteAutoComplete` (Type: Boolean, Default: false): Determines whether the items displayed in the popup come from a remote data source. When this property is set to true, the jqxComboBox calls the 'search' callback function when the user types into the input field. - `remoteAutoCompleteDelay` (Type: Number, Default: 300): Determines the delay between two keystrokes. The search callback function is called on timeout. The value is specified in milliseconds. - `renderer` (Type: function, Default: null): Callback function which is called when an item is rendered. By using the renderer function, you can customize the look of the list items. - `renderSelectedItem` (Type: function, Default: null): Callback function which is called when the selected item is rendered. By using the renderSelectedItem function, you can customize the displayed text in the ComboBox's input field. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `selectedIndex` (Type: Number, Default: -1): Sets or gets the selected index. - `showArrow` (Type: Boolean, Default: true): Determines whether the jqxComboBox shows its dropdown button. - `showCloseButtons` (Type: Boolean, Default: true): Determines whether the jqxComboBox shows the items close buttons in multi-select mode. - `searchMode` (Type: String, Default: startswith): Sets or gets the item search mode. When the user types into the edit field, the jqxComboBox widget tries to find the searched item using the entered text and the selected search mode. - `search` (Type: function, Default: null): Callback function which is called when the 'remoteAutoComplate' property is set to true and the user types into the ComboBox's input field. - `source` (Type: Array, Default: null): Sets or gets the items source. - `scrollBarSize` (Type: Number, Default: 17): Sets or gets the scrollbars size. - `template` (Type: String, Default: 'default'): Determines the button's template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `validateSelection` (Type: Function, Default: null): Determines whether an item can be selected in multi-select mode. - `valueMember` (Type: String, Default: ""): Sets or gets the valueMember of the Items. The valueMember specifies the name of an object property to set as a 'value' of the list items. The name is contained in the collection specified by the 'source' property. - `width` (Type: Number/String, Default: null): Sets or gets the jqxComboBox's width. #### Events - `bindingComplete` (Type: Event): This event is triggered when the data binding operation is completed. - `checkChange` (Type: Event): This event is triggered when an item is checked/unchecked. - `close` (Type: Event): This event is triggered when the popup ListBox is closed. - `change` (Type: Event): This event is triggered when the user selects an item. - `open` (Type: Event): This event is triggered when the popup ListBox is opened. - `select` (Type: Event): This event is triggered when the user selects an item. - `unselect` (Type: Event): This event is triggered when the user unselects an item. #### Methods - `addItem` (Type: Method): Adds a new item to the jqxComboBox. Returns 'true', if the new item is added or 'false' if the item is not added. - `clear` (Type: Method): Clears all items. - `clearSelection` (Type: Method): Clears all selected items. - `clear` (Type: Method): Clears all items. - `close` (Type: Method): Hides the popup listbox. - `checkIndex` (Type: Method): Checks a list item when the 'checkboxes' property value is true. The index is zero-based, i.e to check the first item, the 'checkIndex' method should be called with parameter 0. - `checkItem` (Type: Method): Checks an item. - `checkAll` (Type: Method): Checks all list items when the 'checkboxes' property value is true. - `destroy` (Type: Method): Destroys the widget. - `disableItem` (Type: Method): Disables an item. Item is an Object. - `disableAt` (Type: Method): Disables an item by index. Index is a number. - `enableItem` (Type: Method): Enables an item. Item is an Object. - `enableAt` (Type: Method): Enables a disabled item by index. Index is a number. - `ensureVisible` (Type: Method): Ensures that an item is visible. index is number. When necessary, the jqxComboBox scrolls to the item to make it visible. - `focus` (Type: Method): Sets the focus to the widget. - `getItem` (Type: Method): Gets item by index. The returned value is an Object with the following fields: - `getItemByValue` (Type: Method): Gets an item by its value. The returned value is an Object with the following fields: - `getVisibleItems` (Type: Method): Gets all items displayed in the ComboBox. The method could be useful for getting the currently visible items after auto complete. The returned value is an array of Items. - `getItems` (Type: Method): Gets all items. The returned value is an array of Items. - `getCheckedItems` (Type: Method): Gets the checked items. The returned value is an array of Items. - `getSelectedItem` (Type: Method): Gets the selected item. The returned value is an Object or null(if there is no selected item). - `getSelectedItems` (Type: Method): Gets the selected items when "multiselect" is turned on. The returned value is an Array with Objects. - `getSelectedIndex` (Type: Method): Gets the index of the selected item. The returned value is the index of the selected item. If there's no selected item, -1 is returned. - `insertAt` (Type: Method): Inserts a new item to the jqxComboBox. Returns 'true', if the new item is inserted or false if the insertion fails. The first parameter is Object or String - the new item. - `isOpened` (Type: Method): Returns true, if the popup is opened. Otherwise returns false. - `indeterminateIndex` (Type: Method): Indeterminates a list item when the 'checkboxes' property value is true. The index is zero-based, i.e to indeterminate the first item, the 'indeterminateIndex' method should be called with parameter 0. - `indeterminateItem` (Type: Method): Indeterminates an item. - `loadFromSelect` (Type: Method): Loads list items from a 'select' tag. - `open` (Type: Method): Shows the popup listbox. - `removeItem` (Type: Method): Removes an item from the listbox. Parameter type: Object returned by the "getItem" method or String - the value of an item. Returns 'true', if the item is removed or 'false', if the item is not removed. - `removeAt` (Type: Method): Removes an item from the listbox. Parameter type: Number - the index of the item. The method returns 'true', if the item is removed or 'false', if the item is not removed. - `selectIndex` (Type: Method): Selects an item by index. The index is zero-based, i.e to select the first item, the 'selectIndex' method should be called with parameter 0. - `selectItem` (Type: Method): Selects an item. - `searchString` (Type: Method): Calls `searchString`. - `updateItem` (Type: Method): Updates an item. The first parameter is the new item. The second parameter could be an existing item or the value of an existing item. - `updateAt` (Type: Method): Updates an item. The first parameter is the new item. The second parameter is the index of the item to be updated. - `unselectIndex` (Type: Method): Unselects item by index. The index is zero-based, i.e to unselect the first item, the 'unselectIndex' method should be called with parameter 0. - `unselectItem` (Type: Method): Unselects an item. - `uncheckIndex` (Type: Method): Unchecks a list item when the 'checkboxes' property value is true. The index is zero-based, i.e to uncheck the first item, the 'uncheckIndex' method should be called with parameter 0. - `uncheckItem` (Type: Method): Unchecks an item. - `uncheckAll` (Type: Method): Unchecks all list items when the 'checkboxes' property value is true. - `val` (Type: Method): Sets or gets the selected value. --- ### jQuery ComplexInput Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcomplexinput/jquery-complex-input-getting-started.htm > jQuery ComplexInput getting started: install jQWidgets, add jqxComplexInput to your app, see a complete example, then handle its events and call its methods. jqxComplexInput represents an input widget for entering complex numbers and getting their real and imaginary parts. The complex input also supports on-keydown and on-change number validation. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `3` scripts, listed below - **Demos:** [jQuery ComplexInput demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcomplexinput/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcomplexinput/jquery-complex-input-api.htm) jqxComplexInput in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcomplexinput/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the ComplexInput's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#complexInput').jqxComplexInput({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxcomplexinput/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxComplexInput widget requires the following files: ```html ``` The next step is to create an Input element within the body of the html document: ```html ``` If you wish to enable spin buttons, you would have to create the following HTML structure instead: ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters (if any) in the jqxComplexInput's constructor: ```javascript $("#jqxComplexInput").jqxComplexInput("refresh"); ``` To get the complex input's value, you need to do the following: ```javascript const value = $("#jqxComplexInput").val(); ``` To set a property (option), you need to pass the property name and value(s) in the jqxComplexInput's constructor: ```javascript $("#jqxComplexInput").jqxComplexInput({ width: 150 }); ``` To get a property (option), you need to pass the property name to the jqxComplexInput's constructor: ```javascript const width = $("#jqxComplexInput").jqxComplexInput("width"); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the input value is changed: ```javascript // bind to 'change' event. $('#jqxComplexInput').on('change', function (event) { }); ``` #### Basic Sample ```html jQuery Complex Input Sample ``` --- ### jQuery ComplexInput Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcomplexinput/jquery-complex-input-styling-and-appearance.htm > Style the jQuery ComplexInput: the jqxComplexInput CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxComplexInput. - jqx-complex-input - applied to the complex input. - jqx-input - applied to the complex input. - jqx-widget - applied to the complex input. - jqx-rc-all - applied to the complex input (if the `roundedCorners` property is set to *true* and the spin buttons are not enabled). Adds rounded corners to the widget. - jqx-input-disabled - applied to the complex input when it is disabled. - jqx-fill-state-disabled - applied to the complex input when it is disabled. - jqx-complex-input-rtl - applied to the complex input if the `rtl` property is set to *true*. - jqx-complex-input-spin-buttons-container - applied to the spin buttons container div. When you create a custom style with colors and backgrounds for jqxComplexInput, you need to do the following: - Add the above CSS classes related to jqxComplexInput - After each CSS class, add your theme name. For example: jqx-complex-input-summer - To apply your custom style to jqxComplexInput, you need to set its 'theme' property (option) to point to your theme name string: ```html ``` - The sample below demonstrates how to set the 'summer' theme to jqxComplexInput: ```html jQuery Complex Input Styling Sample ``` --- ### jQuery ComplexInput API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcomplexinput/jquery-complex-input-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxcomplexinput.txt #### Properties - `decimalNotation` (Type: String, Default: 'default'): Sets or gets the notation in which to display the real and imaginary parts of the complex number. - `disabled` (Type: Boolean, Default: false): Enables or disables the jqxComplexInput. - `height` (Type: Number/String, Default: null): Sets or gets the jqxComplexInput's height. - `placeHolder` (Type: String, Default: ''): Sets or gets the jqxComplexInput's placeholder. - `roundedCorners` (Type: boolean, Default: true): Enables or disables the rounded corners functionality. This property setting has effect in browsers which support CSS border-radius. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `spinButtons` (Type: boolean, Default: false): Shows or hides the spin buttons. - `spinButtonsStep` (Type: Number, Default: 1): Sets or gets the increase/decrease step. - `template` (Type: String, Default: 'default'): Determines the template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `value` (Type: String, Default: ''): Sets or gets the value of the jqxComplexInput widget. - `width` (Type: Number/String, Default: null): Sets or gets the jqxComplexInput's width. #### Events - `change` (Type: Event): This event is triggered when the value is changed. #### Methods - `destroy` (Type: Method): Destroys the widget. - `getDecimalNotation` (Type: Method): Calls `getDecimalNotation`. - `getReal` (Type: Method): Gets the real part of the entered number. - `getImaginary` (Type: Method): Gets the imaginary part of the entered number. - `render` (Type: Method): Renders the widget. - `refresh` (Type: Method): Refreshes the widget. - `val` (Type: Method): Sets or gets the value. --- ### jqxDataAdapter Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm > jqxDataAdapter represents a jQuery plug-in which simplifies data binding and data operations and supports binding to local and remote data. jqxDataAdapter represents a jQuery plug-in which simplifies data binding and data operations and supports binding to local and remote data. It supports the following data types: 'xml', 'json', 'csv', 'tsv', 'array', 'observablearray', and the observable collection provided by [Knockout](http://knockoutjs.com/). Many jQWidgets like the jqxListBox, jqxDropDownList, jqxComboBox, jqxGrid and jqxChart support data binding through the jqxDataAdapter plug-in. #### var dataAdapter = new $.jqx.dataAdapter(source, settings) **source:** A set of key/value pairs that configure the jqxDataAdapter's source object. - **url:** A string containing the URL to which the request is sent. - **timeout:** Aborts the data binding on timeout. The default value is null. - **data:** Data to be sent to the server - **datatype:** the data's type. Possible values: 'xml', 'json', 'jsonp', 'tsv', 'csv', 'local', 'array'. - **type:** The type of request to make ("POST" or "GET"), default is "GET" - **id:** A string containing the Id data field. - **root:** A string describing where the data begins and all other loops begin from this element - **record:** A string describing the information for a particular record. - **datafields:** An array describing the fields in a particular record. Each datafield must define the following members: - name - A string containing the data field's name. - type - A string containing the data field's type. Possible values: 'string', 'date', 'number', 'float', 'int' and 'bool' - format(optional) - Sets the data formatting. By setting the format, the jqxDataAdapter plug-in will try to format the data before loading it. Example: { name: 'SubmitDate', type: 'date', format: "yyyy-MM-ddTHH:mm:ss-HH:mm" } - map(optional) - A mapping to the data field. - **mapChar** - specifies the mapping char. By default it is '>'. In the following code, if the mapChar was set to '.', we should use '.' instead of '>' to specify the fields map. ```javascript const data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi" }]; // prepare the data const source = { datatype: "json", datafields: [ { name: 'empName' }, { name: 'age' }, { name: 'id', map: 'department>id' }, { name: 'name', map: 'department>name' }, { name: 'author' }], localdata: data }; const dataAdapter = new $.jqx.dataAdapter(source); ``` - **columnDelimiter** - specifies the column delimiter when the data source is 'tab' or 'csv'. The default value for 'tab' is '\t' and the default value for 'csv' is ','. - **rowDelimiter** - specifies the rows delimiter when the data source is 'tab' or 'csv'. The default value is '\n'. - **values** - determines the foreign collection associated to the data field. ```javascript var employeesSource = { datatype: "xml", datafields: [ { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' }], root: "Employees", record: "Employee", id: 'EmployeeID', url: "../sampledata/employees.xml", async: false }; var employeesAdapter = new $.jqx.dataAdapter(employeesSource, { autoBind: true, beforeLoadComplete: function (records) { const data = new Array(); // update the loaded records. Dynamically add EmployeeName and EmployeeID fields. for (let i = 0; i < records.length; i++) { var employee = records[i]; employee.EmployeeName = employee.FirstName + " " + employee.LastName; employee.EmployeeID = employee.uid; data.push(employee); } return data; } }); // prepare the data var ordersSource = { datatype: "xml", datafields: [ // name - determines the field's name. // value - the field's value in the data source. // values - specifies the field's values. // values.source - specifies the foreign source. The expected value is an array. // values.value - specifies the field's name in the foreign source. // values.name - specifies the field's value in the foreign source. // When the ordersAdapter is loaded, each record will have a field called "EmployeeName". The "EmployeeName" for each record comes from the employeesAdapter where the record's "EmployeeID" from orders.xml matches to the "EmployeeID" from employees.xml. { name: 'EmployeeName', value: 'EmployeeID', values: { source: employeesAdapter.records, value: 'EmployeeID', name: 'EmployeeName' } }, { name: 'EmployeeID', map: 'm\\:properties>d\\:EmployeeID' }, { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: "../sampledata/orders.xml", pager: function (pagenum, pagesize, oldpagenum) { // callback called when a page or page size is changed. } }; var ordersAdapter = new $.jqx.dataAdapter(ordersSource); ``` #### Data fields mapping with XML Data ```xml Customers 2011-11-30T11:39:28Z 2011-11-30T11:39:28Z ALFKI Alfreds Futterkiste Maria Anders Sales Representative Obere Str. 57 Berlin 12209 Germany 030-0074321 030-0076545 ``` ```javascript // prepare the data const source = { datatype: "xml", datafields: [ { name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' }, { name: 'ContactName', map: 'm\\:properties>d\\:ContactName' }, { name: 'ContactTitle', map: 'm\\:properties>d\\:ContactTitle' }, { name: 'City', map: 'm\\:properties>d\\:City' }, { name: 'PostalCode', map: 'm\\:properties>d\\:PostalCode' }, { name: 'Country', map: 'm\\:properties>d\\:Country' }], root: "entry", record: "content", id: 'm\\:properties>d\\:CustomerID', url: url }; ``` #### Data fields mapping with JSON Data ```javascript const data = [ { "state": { "id": "x526", "city": { "name": "Beverly Hills", "id": 90210, "value": "Beverly Hills" } } }]; const source = { datatype: 'json', localdata: data, datafields: [ { name: 'cityName', map: 'state>city>name' }] }; const dataAdapter = new $.jqx.dataAdapter(source); ``` **settings:** A set of key/value pairs that configure the jqxDataAdapter plug-in. All settings are optional. - **async:** By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. When the binding is "asynchronous", the data binding operation occurs in parallel and the order of completion is not guaranteed. - **autoBind** - Automatically calls the dataAdapter's dataBind method on initialization. The default value is false, because the widgets that use the dataAdapter plugin, invoke its dataBind method. - **contentType:** Use this option, If you want to explicitly pass in a content-type. Default is "application/x-www-form-urlencoded". - **processData:** A callback function which allows you to modify the default data object sent to the server. - **formatData:** A callback function which is called before the data is sent to the server. You can use it to fully override the data sent to the server. If you define a 'formatData' function, the result that the function returns will be sent to the server. ```javascript var source = { datatype: "jsonp", datafields: [ { name: 'countryName', type: 'string' }, { name: 'name', type: 'string' }, { name: 'population', type: 'float' }, { name: 'continentCode', type: 'string' }], url: "http://ws.geonames.org/searchJSON" }; var dataAdapter = new $.jqx.dataAdapter(source, { formatData: function (data) { $.extend(data, { featureClass: "P", style: "full", maxRows: 50 }); return data; } } ); ``` - **beforeSend(jqXHR, settings):** A pre-request callback function that can be used to modify the jqXHR - **loadError(jqXHR, status, error):** A callback function called when the request has failed. - **downloadComplete(edata, textStatus, jqXHR):** A callback function which is called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR. - **beforeLoadComplete:** A callback function which is called before the data is fully loaded. The function gets passed two arguments: The loaded records. The second argument is the original data. If the function returns an array, the dataAdapter's records field will be set to it. ```javascript // prepare the data var data = new Array(); var firstNames = [ "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene"]; var lastNames = [ "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier"]; var productNames = [ "Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"]; var priceValues = [ "2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0"]; for (let i = 0; i < 200; i++) { var row = {}; var productindex = Math.floor(Math.random() * productNames.length); var price = parseFloat(priceValues[productindex]); var quantity = 1 + Math.round(Math.random() * 10); row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)]; row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)]; row["productname"] = productNames[productindex]; row["price"] = price; row["quantity"] = quantity; row["total"] = price * quantity; data[i] = row; } var source = { localdata: data, datatype: "array" }; var dataAdapter = new $.jqx.dataAdapter(source, { beforeLoadComplete: function (records) { records[0]['firstname'] = "Michael"; return records; } } ); ``` - **loadComplete:** A callback function which is called when the data is fully loaded. - **loadServerData:** A callback function which allows you to manually handle the ajax calls through the jqxDataAdapter. The function gets passed three arguments: The data to be sent to the server, the source object which initializes the jqxDataAdapter plug-in and a callback function to be called when the ajax call is handled. Note: When you are using jqxDataAdapter plug-in with jqxGrid in virtual mode, the callback function should return an additional field called: 'totalrecords' which specifies the records count. The sorting, filtering and paging information can be retrieved from the 'serverdata' parameter. ```javascript var dataAdapter = new $.jqx.dataAdapter(source, { loadServerData: function (serverdata, source, callback) { $.ajax({ dataType: source.datatype, url: url, data: serverdata, success: function (data, status, xhr) { let xmldata = xmldata || $(source.root + " " + source.record, data); if (!xmldata) { xmldata = []; } const dataArray = new Array(); for (let i = 0; i < xmldata.length; i++) { var record = xmldata[i]; var datarow = {}; for (var j = 0; j < source.datafields.length; j++) { var datafield = source.datafields[j]; var value = ''; if (undefined == datafield || datafield == null) { continue; } if (datafield.map) { value = $(datafield.map, record).text(); } // searches by both selectors when necessary. if (value == '') { value = $(datafield.name, record).text(); } datarow[datafield.name] = value; } dataArray[dataArray.length] = datarow; } // send the loaded records to the jqxDataAdapter plug-in. callback({ records: dataArray }); } }); } } ); ``` To perform data binding operation with the jqxDataAdapter plug-in, you need to call its **dataBind** method. When the data is loaded, all data records are stored in a **records** array. Examples of using jqxDataAdapter: #### Asynchronous Binding ```html Data Adapter bound to XML data.
``` #### Binding to Local Array ```html Data Adapter bound to Array data.
``` #### Dynamic Data Refresh ```html Data Adapter bound to XML data.
``` #### Binding to JSON using PHP Let's see how to get data in JSON format from a file called data.php. ##### data.php ```html ``` ##### index.php ```html Data Adapter bound to JSON data.
``` ##### Data Binding to Nested JSON In order to use a nested JSON as a data source, you will have to do the following: 1. Add the sub-collection to the `dataFields` array and set its `type` to "array". In the code below, the sub-collection's name is `children`. 2. Add a `hierarchy` object as a member of the `source` object. 3. Add a member called `root` to the `hierarchy` object. 4. Set the `root` to the sub-collection name. ```javascript var employees = [ { "EmployeeID": 2, "FirstName": "Andrew", "LastName": "Fuller", "Country": "USA", "Title": "Vice President, Sales", "HireDate": "2024-08-09 00:00:00", "BirthDate": "1984-02-14 00:00:00", "City": "Tacoma", "Address": "908 W. Capital Way", "expanded": "true", children: [ { "EmployeeID": 8, "FirstName": "Laura", "LastName": "Callahan", "Country": "USA", "Title": "Inside Sales Coordinator", "HireDate": "2026-02-28 00:00:00", "BirthDate": "1990-01-04 00:00:00", "City": "Seattle", "Address": "4726 - 11th Ave. N.E." }, { "EmployeeID": 1, "FirstName": "Nancy", "LastName": "Davolio", "Country": "USA", "Title": "Sales Representative", "HireDate": "2024-04-26 00:00:00", "BirthDate": "1980-12-03 00:00:00", "City": "Seattle", "Address": "507 - 20th Ave. E.Apt. 2A" }, { "EmployeeID": 3, "FirstName": "Janet", "LastName": "Leverling", "Country": "USA", "Title": "Sales Representative", "HireDate": "2024-03-27 00:00:00", "BirthDate": "1995-08-25 00:00:00", "City": "Kirkland", "Address": "722 Moss Bay Blvd." }, { "EmployeeID": 4, "FirstName": "Margaret", "LastName": "Peacock", "Country": "USA", "Title": "Sales Representative", "HireDate": "2025-04-28 00:00:00", "BirthDate": "1969-09-14 00:00:00", "City": "Redmond", "Address": "4110 Old Redmond Rd." }, { "EmployeeID": 5, "FirstName": "Steven", "LastName": "Buchanan", "Country": "UK", "Title": "Sales Manager", "HireDate": "2025-10-12 00:00:00", "BirthDate": "1987-02-27 00:00:00", "City": "London", "Address": "14 Garrett Hill", "expanded": "true", children: [ { "EmployeeID": 6, "FirstName": "Michael", "LastName": "Suyama", "Country": "UK", "Title": "Sales Representative", "HireDate": "2025-10-12 00:00:00", "BirthDate": "1995-06-27 00:00:00", "City": "London", "Address": "Coventry House Miner Rd." }, { "EmployeeID": 7, "FirstName": "Robert", "LastName": "King", "Country": "UK", "Title": "Sales Representative", "HireDate": "2025-12-28 00:00:00", "BirthDate": "1992-05-24 00:00:00", "City": "London", "Address": "Edgeham Hollow Winchester Way" }, { "EmployeeID": 9, "FirstName": "Anne", "LastName": "Dodsworth", "Country": "UK", "Title": "Sales Representative", "HireDate": "2026-11-10 00:00:00", "BirthDate": "1998-01-22 00:00:00", "City": "London", "Address": "7 Houndstooth Rd." }] }] }]; // prepare the data var source = { dataType: "json", dataFields: [ { name: 'EmployeeID', type: 'number' }, { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' }, { name: 'Country', type: 'string' }, { name: 'City', type: 'string' }, { name: 'Address', type: 'string' }, { name: 'Title', type: 'string' }, { name: 'HireDate', type: 'date' }, { name: 'children', type: 'array' }, { name: 'expanded', type: 'bool' }, { name: 'BirthDate', type: 'date' }], hierarchy: { root: 'children' }, id: 'EmployeeID', localData: employees }; var dataAdapter = new $.jqx.dataAdapter(source); ``` ##### Data Binding to Nested XML In order to use a nested XML as a data source, you will have to do the following: 1. Set the `root`, `record` and `id` members of the source object. For more information about these members, visit: [jquery-data-adapter.htm](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm). 2. Add a `hierarchy` object as a member of the `source` object. 3. Add `root` and `record` members to the `hierarchy` object to specify the nested sequence. XML Data - employees.xml ```xml Fuller Andrew Vice President, Sales Dr. 1984-02-14 2024-08-09
908 W. Capital Way
Tacoma WA 98401 3457 Andrew received his BTS commercial in 2006 and a Ph.D. in international marketing from the University of Dallas in 2013. He is fluent in French and Italian and reads German. He joined the company as a sales representative, was promoted to sales manager in January 2024 and to vice president of sales in March 2025. Andrew is a member of the Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association. Callahan Laura Inside Sales Coordinator Ms. 1990-01-04 2026-02-28
4726 - 11th Ave. N.E.
Seattle WA 98105 2344 Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.
Davolio Nancy Sales Representative Ms. 1980-12-03 2024-04-26
507 - 20th Ave. E. Apt. 2A
Seattle WA 98122 5467 Education includes a BA in psychology from Colorado State University in 2002. She also completed "The Art of the Cold Call." Nancy is a member of Toastmasters International.
Buchanan Steven Sales Manager Mr. 1987-02-27 2025-10-12
14 Garrett Hill
London SW1 8JR 3453 Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 2008. Upon joining the company as a sales representative in 2024, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent post in London. He was promoted to sales manager in March 2025. Mr. Buchanan has completed the courses "Successful Telemarketing" and "International Sales Management." He is fluent in French. Dodsworth Anne Sales Representative Ms. 1998-01-22 2026-11-10
7 Houndstooth Rd.
London WG2 7LT 452 Anne has a BA degree in English from St. Lawrence College. She is fluent in French and German.
King Robert Sales Representative Mr. 1992-05-24 2025-12-28
Edgeham Hollow Winchester Way
London RG1 9SP 465 Robert King served in the Peace Corps and traveled extensively before completing his degree in English at the University of Michigan in 2024, the year he joined the company. After completing a course entitled "Selling in Europe," he was transferred to the London office in March 2025.
Suyama Michael Sales Representative Mr. 1995-06-27 2025-10-12
Coventry House Miner Rd.
London EC2 7JR 428 Michael is a graduate of Sussex University (MA, economics, 2015) and the University of California at Los Angeles (MBA, marketing, 2018). He has also taken the courses "Multi-Cultural Selling" and "Time Management for the Sales Professional." He is fluent in Japanese and can read and write French, Portuguese, and Spanish.
Leverling Janet Sales Representative Ms. 1995-08-25 2024-03-27
722 Moss Bay Blvd.
Kirkland WA 98033 3355 Janet has a BS degree in chemistry from Boston College (2016). She has also completed a certificate program in food retailing management. Janet was hired as a sales associate in 2023 and promoted to sales representative in February 2024.
Peacock Margaret Sales Representative Mrs. 1969-09-14 2025-04-28
4110 Old Redmond Rd.
Redmond WA 98052 5176 Margaret holds a BA in English literature from Concordia College (1990) and an MA from the American Institute of Culinary Arts (1998). She was assigned to the London office temporarily from July through November 2024.
``` ```javascript const source = { dataType: "xml", dataFields: [ { name: 'EmployeeID', type: 'number' }, { name: 'ReportsTo', type: 'number' }, { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' }, { name: 'City', type: 'string' }, { name: 'Address', type: 'string' }, { name: 'Title', type: 'string' }, { name: 'HireDate', type: 'date' }, { name: 'BirthDate', type: 'date' }], hierarchy: { // defines the root and record of each hiearchy level. root: 'Employees', record: 'Employee' }, id: 'EmployeeID', root: 'Employees', record: 'Employee', url: "employees.xml" }; const dataAdapter = new $.jqx.dataAdapter(source); ``` ##### Data Binding to Observable Array ```javascript var observableArray = new $.jqx.observableArray(array, function (changed) { }); var source = { localdata: observableArray, datatype: "obserableArray", datafields: [ { name: 'firstname', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' }, { name: 'total', type: 'number' }] }; var dataAdapter = new $.jqx.dataAdapter(source); ``` Please visit: [javascript-observable-array.htm](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxobservablearray/javascript-observable-array.htm) for more information about observable arrays. #### Methods and Properties - dataBind - performs data binding. - records - gets the array of the loaded data records when the data binding is completed. - beginUpdate - begins data update operation. If you need to update multiple records at once, call this method before the update. - endUpdate(refresh) - ends the data update operation. Performs data refresh by default, if you call the method without params or with true parameter. - getRecordsHierarchy - gets the array of the loaded data records and builds a data tree. The method has 4 parameters, the last 2 of which are optional. The first parameter is the field’s id. The second parameter represents the parent field’s id. These parameters should point to a valid ‘datafield’ from the Data Source. The third parameter which is optional specifies the name of the ‘children’ collection. The last parameter specifies the mapping between the Data Source fields and custom data fields. ```javascript var data = [ { "id": "2", "parentid": "1", "text": "Hot Chocolate" }, { "id": "3", "parentid": "1", "text": "Peppermint Hot Chocolate" }, { "id": "4", "parentid": "1", "text": "Salted Caramel Hot Chocolate" }, { "id": "5", "parentid": "1", "text": "White Hot Chocolate" }, { "text": "Chocolate Beverage", "id": "1", "parentid": "-1" }, { "id": "6", "text": "Espresso Beverage", "parentid": "-1" }, { "id": "7", "parentid": "6", "text": "Caffe Americano" }, { "id": "8", "text": "Caffe Latte", "parentid": "6" }, { "id": "9", "text": "Caffe Mocha", "parentid": "6" }, { "id": "10", "text": "Cappuccino", "parentid": "6" }, { "id": "11", "text": "Pumpkin Spice Latte", "parentid": "6" }, { "id": "12", "text": "Frappuccino", "parentid": "-1" }, { "id": "13", "text": "Caffe Vanilla Frappuccino", "parentid": "12" }, { "id": "15", "text": "450 calories", "parentid": "13" }, { "id": "16", "text": "16g fat", "parentid": "13" }, { "id": "17", "text": "13g protein", "parentid": "13" }, { "id": "14", "text": "Caffe Vanilla Frappuccino Light", "parentid": "12" }]; // prepare the data var source = { datatype: "json", datafields: [ { name: 'id' }, { name: 'parentid' }, { name: 'text' }], id: 'id', localdata: data }; // create data adapter. var dataAdapter = new $.jqx.dataAdapter(source); // perform Data Binding. dataAdapter.dataBind(); // get records. var records = dataAdapter.getRecordsHierarchy('id', 'parentid', 'items', [{ name: 'text', map: 'label' }]); ``` - getGroupedRecords - gets the array of the loaded data records and groups them. The method has 4 parameters. The first parameter is an array of grouping fields. The second parameter is the sub items collection name. The third parameter is the group's name. The last parameter specifies the mapping between the Data Source fields and custom data fields. ```javascript const source = { datatype: "xml", datafields: [ { name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' }, { name: 'ContactName', map: 'm\\:properties>d\\:ContactName' }, { name: 'ContactTitle', map: 'm\\:properties>d\\:ContactTitle' }, { name: 'City', map: 'm\\:properties>d\\:City' }, { name: 'PostalCode', map: 'm\\:properties>d\\:PostalCode' }, { name: 'Country', map: 'm\\:properties>d\\:Country' }], root: "entry", record: "content", id: 'm\\:properties>d\\:CustomerID', url: "../sampledata/customers.xml", async: false }; // create data adapter. const dataAdapter = new $.jqx.dataAdapter(source); // perform Data Binding. dataAdapter.dataBind(); const records = dataAdapter.getGroupedRecords(['Country', 'City'], 'items', 'label', [{ name: 'CompanyName', map: 'label' }]); ``` - getAggregatedData - gets an array of aggregated data. The getAggregatedData method accepts 3 params. The first parameter is an array which defines the data fields, type of functions and format strings. Possible Numeric formats: "d" - decimal numbers. "f" - floating-point numbers. "n" - integer numbers. "c" - currency numbers. "p" - percentage numbers. For adding decimal places to the numbers, add a number after the formatting string. For example: "c3" displays a number in this format $25.256 Possible Date formats: // short date pattern d: "M/d/yyyy", // long date pattern D: "dddd, MMMM dd, yyyy", // short time pattern t: "h:mm tt", // long time pattern T: "h:mm:ss tt", // long date, short time pattern f: "dddd, MMMM dd, yyyy h:mm tt", // long date, long time pattern F: "dddd, MMMM dd, yyyy h:mm:ss tt", // month/day pattern M: "MMMM dd", // month/year pattern Y: "yyyy MMMM", // S is a sortable format that does not vary by culture S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss" Possible Date format strings: "d"-the day of the month; "dd"-the day of the month; "ddd"-the abbreviated name of the day of the week; "dddd"- the full name of the day of the week; "h"-the hour, using a 12-hour clock from 1 to 12; "hh"-the hour, using a 12-hour clock from 01 to 12; "H"-the hour, using a 24-hour clock from 0 to 23; "HH"- the hour, using a 24-hour clock from 00 to 23; "m"-the minute, from 0 through 59; "mm"-the minutes,from 00 though59; "M"- the month, from 1 through 12; "MM"- the month, from 01 through 12; "MMM"-the abbreviated name of the month; "MMMM"-the full name of the month; "s"-the second, from 0 through 59; "ss"-the second, from 00 through 59; "t"- the first character of the AM/PM designator; "tt"-the AM/PM designator; "y"- the year, from 0 to 99; "yy"- the year, from 00 to 99; "yyy"-the year, with a minimum of three digits; "yyyy"-the year as a four-digit number; "yyyyy"-the year as a four-digit number. The supported aggregates are: The following code shows how to specify the data formatting when calling the getAggregatedData method. The second parameter is optional and represents a localization object specified in this format: The last parameter is optional, too. It allows you to pass an array of records to the method. By default, the method aggregates the data loaded via the data adapter. ```html <>var dataAdapter = new $.jqx.dataAdapter(source); dataAdapter.dataBind(); var summaryData = dataAdapter.getAggregatedData([ { name: 'quantity', aggregates: ['min', 'max', 'sum'] }, { name: 'price', aggregates: ['avg', 'product', 'count'] } ]); ``` - 'avg' - Average aggregate - 'count' - Count aggregate - 'min' - Min aggregate - 'max' - Max aggregate - 'sum' - Sum aggregate - 'product' - Product aggregate - 'stdev' - Standard deviation on a sample - 'stdevp' - Standard deviation on a population - 'var' - Variance on an a sample - 'varp' - Variance on an entire population. ```javascript const dataAdapter = new $.jqx.dataAdapter(source); dataAdapter.dataBind(); const summaryData = dataAdapter.getAggregatedData([ { name: 'quantity', aggregates: ['min', 'max', 'sum'], formatStrings: ['n', 'n', 'n'] }, { name: 'price', aggregates: ['avg', 'sum', 'count'], formatStrings: ['c2', 'c2', 'n'] }] ); ``` ```javascript var calendar = { // separator of parts of a date (e.g. '/' in 11/05/1955) '/': "/", // separator of parts of a time (e.g. ':' in 05:44 PM) ':': ":", // the first day of the week (0 = Sunday, 1 = Monday, etc) firstDay: 0, days: { // full day names names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // abbreviated day names namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // shortest day names namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] }, months: { // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], // abbreviated month names namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""] }, // AM and PM designators in one of these forms: // The usual view, and the upper and lower case versions // [standard,lowercase,uppercase] // The culture does not use AM or PM (likely all standard date formats use 24 hour time) // null AM: ["AM", "am", "AM"], PM: ["PM", "pm", "PM"], eras: [ // eras in reverse chronological order. // name: the name of the era in this culture (e.g. A.D., C.E.) // start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era. // offset: offset in years from gregorian calendar { "name": "A.D.", "start": null, "offset": 0 }], twoDigitYearMax: 2029, patterns: { // short date pattern d: "M/d/yyyy", // long date pattern D: "dddd, MMMM dd, yyyy", // short time pattern t: "h:mm tt", // long time pattern T: "h:mm:ss tt", // long date, short time pattern f: "dddd, MMMM dd, yyyy h:mm tt", // long date, long time pattern F: "dddd, MMMM dd, yyyy h:mm:ss tt", // month/day pattern M: "MMMM dd", // month/year pattern Y: "yyyy MMMM", // S is a sortable format that does not vary by culture S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss", // formatting of dates in MySQL DataBases ISO: "yyyy-MM-dd hh:mm:ss", d1: "dd.MM.yyyy", d2: "dd-MM-yyyy" }, percentsymbol: "%", currencysymbol: "$", currencysymbolposition: "before", decimalseparator: '.', thousandsseparator: ',' }; ``` - formatDate Returns a Formatted JavaScript Date object as a String. Function arguments: value(JavaScript Date object), format(String) and calendar(Object) Code example - format Possible Date formats: // short date pattern d: "M/d/yyyy", // long date pattern D: "dddd, MMMM dd, yyyy", // short time pattern t: "h:mm tt", // long time pattern T: "h:mm:ss tt", // long date, short time pattern f: "dddd, MMMM dd, yyyy h:mm tt", // long date, long time pattern F: "dddd, MMMM dd, yyyy h:mm:ss tt", // month/day pattern M: "MMMM dd", // month/year pattern Y: "yyyy MMMM", // S is a sortable format that does not vary by culture S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss" Possible Date format strings: "d"-the day of the month; "dd"-the day of the month; "ddd"-the abbreviated name of the day of the week; "dddd"- the full name of the day of the week; "h"-the hour, using a 12-hour clock from 1 to 12; "hh"-the hour, using a 12-hour clock from 01 to 12; "H"-the hour, using a 24-hour clock from 0 to 23; "HH"- the hour, using a 24-hour clock from 00 to 23; "m"-the minute, from 0 through 59; "mm"-the minutes,from 00 though59; "M"- the month, from 1 through 12; "MM"- the month, from 01 through 12; "MMM"-the abbreviated name of the month; "MMMM"-the full name of the month; "s"-the second, from 0 through 59; "ss"-the second, from 00 through 59; "t"- the first character of the AM/PM designator; "tt"-the AM/PM designator; "y"- the year, from 0 to 99; "yy"- the year, from 00 to 99; "yyy"-the year, with a minimum of three digits; "yyyy"-the year as a four-digit number; - calendar The structure of the expected calendar object is shown below: var calendar = { // separator of parts of a date (e.g. '/' in 11/05/1955) '/': "/", // separator of parts of a time (e.g. ':' in 05:44 PM) ':': ":", // the first day of the week (0 = Sunday, 1 = Monday, etc) firstDay: 0, days: { // full day names names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // abbreviated day names namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // shortest day names namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] }, months: { // full month names (13 months for lunar calendars -- 13th month should be "" if not lunar) names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], // abbreviated month names namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""] }, // AM and PM designators in one of these forms: // The usual view, and the upper and lower case versions // [standard,lowercase,uppercase] // The culture does not use AM or PM (likely all standard date formats use 24 hour time) // null AM: ["AM", "am", "AM"], PM: ["PM", "pm", "PM"], eras: [ // eras in reverse chronological order. // name: the name of the era in this culture (e.g. A.D., C.E.) // start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era. // offset: offset in years from gregorian calendar {"name": "A.D.", "start": null, "offset": 0 } ], twoDigitYearMax: 2029, patterns: { // short date pattern d: "M/d/yyyy", // long date pattern D: "dddd, MMMM dd, yyyy", // short time pattern t: "h:mm tt", // long time pattern T: "h:mm:ss tt", // long date, short time pattern f: "dddd, MMMM dd, yyyy h:mm tt", // long date, long time pattern F: "dddd, MMMM dd, yyyy h:mm:ss tt", // month/day pattern M: "MMMM dd", // month/year pattern Y: "yyyy MMMM", // S is a sortable format that does not vary by culture S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss", // formatting of dates in MySQL DataBases ISO: "yyyy-MM-dd hh:mm:ss", d1: "dd.MM.yyyy", d2: "dd-MM-yyyy" }, percentsymbol: "%", currencysymbol: "$", currencysymbolposition: "before", decimalseparator: '.', thousandsseparator: ',' } ```javascript const formattedDate = dataAdapter.formatDate(new Date(), 'D'); ``` - formatNumber Returns a Formatted Number as a String. The `formatNumber` function can be used for formatting integer, float, decimal, currency and percentage values. Function arguments: value(Number), format(String) and calendar(Object) Code example - format Possible Numeric formats: "d" - decimal numbers. "f" - floating-point numbers. "n" - integer numbers. "c" - currency numbers. "p" - percentage numbers. For adding decimal places to the numbers, add a number after the formatting string. For example: "c3" displays a number in this format $25.256 - calendar The structure of the expected calendar object is shown below: var calendar = { // separator of parts of a date (e.g. '/' in 11/05/1955) '/': "/", // separator of parts of a time (e.g. ':' in 05:44 PM) ':': ":", // the first day of the week (0 = Sunday, 1 = Monday, etc) firstDay: 0, days: { // full day names names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // abbreviated day names namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // shortest day names namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] }, months: { // full month names (13 months for lunar calendars -- 13th month should be "" if not lunar) names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], // abbreviated month names namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""] }, // AM and PM designators in one of these forms: // The usual view, and the upper and lower case versions // [standard,lowercase,uppercase] // The culture does not use AM or PM (likely all standard date formats use 24 hour time) // null AM: ["AM", "am", "AM"], PM: ["PM", "pm", "PM"], eras: [ // eras in reverse chronological order. // name: the name of the era in this culture (e.g. A.D., C.E.) // start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era. // offset: offset in years from gregorian calendar {"name": "A.D.", "start": null, "offset": 0 } ], twoDigitYearMax: 2029, patterns: { // short date pattern d: "M/d/yyyy", // long date pattern D: "dddd, MMMM dd, yyyy", // short time pattern t: "h:mm tt", // long time pattern T: "h:mm:ss tt", // long date, short time pattern f: "dddd, MMMM dd, yyyy h:mm tt", // long date, long time pattern F: "dddd, MMMM dd, yyyy h:mm:ss tt", // month/day pattern M: "MMMM dd", // month/year pattern Y: "yyyy MMMM", // S is a sortable format that does not vary by culture S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss", // formatting of dates in MySQL DataBases ISO: "yyyy-MM-dd hh:mm:ss", d1: "dd.MM.yyyy", d2: "dd-MM-yyyy" }, percentsymbol: "%", currencysymbol: "$", currencysymbolposition: "before", decimalseparator: '.', thousandsseparator: ',' } ```javascript const formattedNumber = dataAdapter.formatNumber(10, 'c2'); ``` --- ### jQuery DataTable Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-getting-started.htm > jQuery DataTable getting started: install jQWidgets, add jqxDataTable to your app, see a complete example, then handle its events and call its methods. jqxDataTable is a lightweight jQuery Table widget built to easily replace your HTML Tables. It can read and display the data from your HTML Table, but it can also display data from various data sources like XML, JSON, Array, CSV or TSV. jqxDataTable comes with easy to use APIs and works across devices and browsers. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `5` scripts, listed below - **Demos:** [jQuery DataTable demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatatable/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-api.htm) jqxDataTable in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatatable/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the DataTable's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#dataTable').jqxDataTable({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatatable/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxDataTable widget requires the following files: ```html ``` jqxDataTable does not need jQuery: jqxcore.js has the small DOM layer it uses, and you can still add jQuery if your page uses it. Include the jQWidgets core framework file - jqxcore.js, the jQWidgets data binding file - jqxdata.js, the main jqxDataTable plug-in file - jqxdatatable.js file, the jQWidgets Scrollbar plug-in - jqxbutton.js and jqxscrollbar.js(used for the DataTable scrolling), jQWidgets DropDownList plug-in(used in the DataTable's Pager and Filtering panel) - jqxlistbox.js and jqxdropdownlist.js, and the base jQWidgets stylesheet - jqx.base.css: The next step is to create a DIV element within the body of the html document in case you will not initialize jqxDataTable from an existing HTML Table element. ```html
``` The last step is to initialize the widget. In order to initialize the DataTable, you need to set its **source** and **columns** properties. Add the following script to the html document: ```javascript $("#dataTable").jqxDataTable( { source: dataAdapter, columns: [ { text: 'First Name', dataField: 'First Name', width: 100 }, { text: 'Last Name', dataField: 'Last Name', width: 100 }, { text: 'Product', dataField: 'Product', width: 180 }, { text: 'Unit Price', dataField: 'Price', width: 90, align: 'right', cellsAlign: 'right', cellsFormat: 'c2' }, { text: 'Quantity', dataField: 'Quantity', width: 80, align: 'right', cellsAlign: 'right' } ] }); ``` To set a property(option), you need to pass the property name and value(s) to the jqxDataTable's constructor. ```javascript $("#dataTable").jqxDataTable({ disabled: true}); ``` To get a property(option), you need to pass the property name to the jqxDataTable's constructor. ```javascript const disabled = $("#dataTable").jqxDataTable('disabled'); ``` To call a function, you need to pass the function name and parameters(if any). ```javascript $("#dataTable").jqxDataTable('selectRow', 1); ``` To attach an event handler function to the jqxDataTable widget, you can use the jQuery's **.on()** method. Let’s suppose that you want to write code which does something when the user selects a row. The example code below demonstrates how to bind to the ‘rowSelect’ event of jqxDataTable. ```javascript $("#dataTable").on('rowSelect', function (event) { // event arguments const args = event.args; // row index const index = args.index; // row data const rowData = args.row; // row key const rowKey = args.key; }); ``` Most of the browser events bubble from the element(the event target) where they occur up to the body and the document element. By default, most events bubble up from the original event target to the document element. At each element along the way, jQuery calls any matching event handlers that have been attached. An event handler can prevent the event from bubbling further up the document tree (and thus prevent handlers on those elements from running) by calling **event.stopPropagation()**. Any other handlers attached on the current element will run however. To prevent that, call **event.stopImmediatePropagation()**. (Event handlers bound to an element are called in the same order that they were bound.) The code sample below illustrates how to stop the **rowSelect** event from bubbling using the **.stopPropagation()** method. ```javascript $("#dataTable").on('rowSelect', function (event) { // event arguments const args = event.args; // row index const index = args.index; // row data const rowData = args.row; // row key const rowKey = args.key; event.stopPropagation(); }); ``` #### Basic DataTable Sample ```html This demo illustrates the basic functionality of jqxDataTable. jqxDataTable is built to easily replace your HTML Tables. It can read and display the data from your HTML Table, but it can also display data from different data sources like XML, JSON, Array, CSV or TSV.
First Name Last Name Product Price Quantity
Ian Devling Espresso Truffle $1.75 8
Nancy Wilson Cappuccino $5.00 3
Cheryl Nodier Caffe Americano $2.50 4
Martin Saavedra Caramel Latte $3.80 11
Guylene Bjorn Green Tea $1.50 8
Andrew Burke Caffe Espresso $3.00 2
Regina Murphy White Chocolate Mocha $3.60 6
Michael Murphy Caramel Latte $3.80 2
Petra Bein Caffe Americano $2.50 7
Nancy Nodier Caffe Latte $4.50 10
Peter Devling Green Tea $1.50 1
Beate Saylor Espresso con Panna $3.25 3
Shelley Nodier Peppermint Mocha Twist $4.00 7
Nancy Murphy Peppermint Mocha Twist $4.00 1
Lars Wilson Caffe Espresso $3.00 11
``` --- ### DataTable Data Sources Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-data-sources.htm > The DataTable plugin can be bound to multiple types of data collections including arrays, xml, json, tsv, csv or remote data. The DataTable plugin can be bound to multiple types of data collections including arrays, xml, json, tsv, csv or remote data. To data bind the DataTable to a data source you need to set its `source` property to point to an instance of jqxDataAdapter. The source object represents a set of key/value pairs. - url: A string containing the URL to which the request is sent. - data: Data to be sent to the server. - localData: data array or data string pointing to a local data source. - dataType: the data's type. Possible values: 'xml', 'json', 'jsonp', 'tsv', 'csv', 'local', 'array', 'observablearray'. - type: The type of request to make ("POST" or "GET"), default is "GET". - id: A string containing the Id data field. - root: A string describing where the data begins and all other loops begin from this element. - record: A string describing the information for a particular record. `XML Data` ```javascript const source = { dataType: "xml", dataFields: [ { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: 'orders.xml' }; ``` ```html http://services.odata.org/Northwind/Northwind.svc/Orders(10248) 2011-12-01T11:55:06Z 10248 VINET 5 1996-07-04T00:00:00 1996-08-01T00:00:00 1996-07-16T00:00:00 3 32.3800 Vins et alcools Chevalier 59 rue de l'Abbaye Reims 51100 France http://services.odata.org/Northwind/Northwind.svc/Orders(10249) 2011-12-01T11:55:06Z 10249 TOMSP 6 1996-07-05T00:00:00 1996-08-16T00:00:00 1996-07-10T00:00:00 1 11.6100 Toms Spezialitäten Luisenstr. 48 Münster 44087 Germany ``` - dataFields: An array describing the fields in a particular record. Each data field must define the following members: - name - A string containing the data field's name. - type - A string containing the data field's type. Possible values: 'string', 'date', 'number', 'float', 'int', 'bool'. - format(optional) - Sets the data formatting. By setting the format, the jqxDataAdapter plug-in will try to format the data before loading it. Example: { name: 'SubmitDate', type: 'date', format: "yyyy-MM-ddTHH:mm:ss-HH:mm" } - columnDelimiter(optional) - specifies the column delimiter when the data source is 'tab' or 'csv'. The default value for 'tab' is '\t' and the default value for 'csv' is ','. - rowDelimiter(optional) - specifies the rows delimiter when the data source is 'tab' or 'csv'. The default value is '\n'. - mapChar(optional) - specifies the mapping char. By default it is '>'. - map(optional) - A mapping to the data field. `Loading XML Data` `XML Data` `Loading Nested JSON Data` `Loading data with XML Attributes` `XML Data` Initialize the jqxDataAdapter plug-in. Initialize the jqxDataTable. `Loading Nested JSON Data` ```javascript { name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' } ``` ```html ALFKI Alfreds Futterkiste Maria Anders Sales Representative Obere Str. 57 Berlin 12209 Germany 030-0074321 030-0076545 ``` ```javascript const data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi" }]; // prepare the data const source = { dataType: "json", dataFields: [ { name: 'empName' }, { name: 'age' }, { name: 'id', map: 'department>id' }, { name: 'name', map: 'department>name' }, { name: 'author' }], localData: data }; const dataAdapter = new $.jqx.dataAdapter(source); ``` ```xml ``` ```javascript const url = "../sampledata/customers.xml"; // prepare the data const source = { datatype: "xml", datafields: [ { name: 'CustomerID', map: '[CustomerID]' }, { name: 'Name', map: '[Name]' }], root: "Customers", record: "Customer", url: url }; const dataAdapter = new $.jqx.dataAdapter(source); ``` ```javascript $("#dataTable").jqxDataTable( { width: 400, source: dataAdapter, columns: [ { text: 'ID', dataField: 'CustomerID', width: 250 }, { text: 'Name', dataField: 'Name', width: 150 } ] }); ``` ```javascript const data = [ { "state": { "id": "x526", "city": { "name": "Beverly Hills", "id": 90210, "value": "Beverly Hills" } } }]; const source = { dataType: 'json', localData: data, dataFields: [ { name: 'cityName', map: 'state>city>name' }] }; const dataAdapter = new $.jqx.dataAdapter(source); ``` - values - determines the foreign collection associated to the data field. `Join Two Data Sources` ```javascript var employeesSource = { datatype: "xml", datafields: [ { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' }], root: "Employees", record: "Employee", id: 'EmployeeID', url: "../sampledata/employees.xml", async: false }; var employeesAdapter = new $.jqx.dataAdapter(employeesSource, { autoBind: true, beforeLoadComplete: function (records) { const data = new Array(); // update the loaded records. Dynamically add EmployeeName and EmployeeID fields. for (let i = 0; i < records.length; i++) { var employee = records[i]; employee.EmployeeName = employee.FirstName + " " + employee.LastName; employee.EmployeeID = employee.uid; data.push(employee); } return data; } }); // prepare the data var ordersSource = { dataType: "xml", dataFields: [ // name - determines the field's name. // value - the field's value in the data source. // values - specifies the field's values. // values.source - specifies the foreign source. The expected value is an array. // values.value - specifies the field's name in the foreign source. // values.name - specifies the field's value in the foreign source. // When the ordersAdapter is loaded, each record will have a field called "EmployeeName". The "EmployeeName" for each record comes from the employeesAdapter where the record's "EmployeeID" from orders.xml matches to the "EmployeeID" from employees.xml. { name: 'EmployeeName', value: 'EmployeeID', values: { source: employeesAdapter.records, value: 'EmployeeID', name: 'EmployeeName' } }, { name: 'EmployeeID', map: 'm\\:properties>d\\:EmployeeID' }, { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: "../sampledata/orders.xml", pager: function (pagenum, pagesize, oldpagenum) { // callback called when a page or page size is changed. } }; var ordersAdapter = new $.jqx.dataAdapter(ordersSource); ``` - pageNum - determines the initial page number when paging is enabled. - pageSize - determines the page size when paging is enabled. - pager - callback function called when the current page or page size is changed. ```javascript pager: function (pagenum, pagesize, oldpagenum) { } ``` - sortColumn - determines the initial sort column. The expected value is a data field name. - sortDirection - determines the sort order. The expected value is 'asc' for (A to Z) sorting or 'desc' for (Z to A) sorting. - sort - callback function called when the sort column or sort order is changed. ```javascript sort: function (column, direction) { } ``` - filter - callback function called when a filter is applied or removed. ```javascript filter: function(filters, recordsArray) { } ``` - addRow - callback function, called when a new row is/are added. If multiple rows are added, the rowid and rowdata parameters are arrays of row ids and rows. ```javascript addRow: function (rowId, rowData, position, commit) { // synchronize with the server - send insert command // call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. commit(true); } ``` - deleteRow - callback function, called when a row is deleted. If multiple rows are deleted, the rowid parameter is an array of row ids. ```javascript deleteRow: function (rowId, commit) { // synchronize with the server - send delete command // call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. commit(true); } ``` - updateRow - callback function, called when a row is updated. If multiple rows are added, the rowid and rowdata parameters are arrays of row ids and rows. ```javascript updateRow: function (rowId, newRowData, commit) { // synchronize with the server - send update command // call commit with parameter true if the synchronization with the server is successful // and with parameter false if the synchronization failed. commit(true); } ``` - formatData - Before the data is sent to the server, you can fully override it by using the `formatData` function of the `source` object. The result that the `formatData` function returns would be sent to the server. ```javascript var source = { datatype: "jsonp", datafields: [ { name: 'countryName' }, { name: 'name' }, { name: 'population', type: 'float' }, { name: 'continentCode' }], url: "http://ws.geonames.org/searchJSON", data: { featureClass: "P", style: "full", maxRows: 50 }, formatdata: function (data) { return "my data"; } }; ``` - contentType: Use this option, If you want to explicitly pass in a content-type. Default is "application/x-www-form-urlencoded". The example code below illustrates how to create jqxDataAdapter from a source object. ```javascript var dataAdapter = new $.jqx.dataAdapter(source, { loadComplete: function (data) { // data is loaded. }, loadError: function (xhr, status, error) { // data is not loaded. } }); ``` If you bind the DataTable to a remote data source using asynchronous requests(that is by default when you set the source object's `url` member and you did not set the `async` field to false), then make sure that you call any method or set a property once the data is loaded. To ensure that you call your code when the DataTable is loaded with data, you can use the DataTable's `ready` callback function or bind to the `bindingComplete` event before the DataTable's initialization and add your code inside the event handler. #### Example The sample code below shows how to use the `ready` callback function: ```javascript var url = "../sampledata/beverages.txt"; // prepare the data var source = { dataType: "json", dataFields: [ { name: 'name', type: 'string' }, { name: 'type', type: 'string' }, { name: 'calories', type: 'int' }, { name: 'totalfat', type: 'string' }, { name: 'protein', type: 'string' }], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#dataTable").jqxDataTable( { width: 400, source: dataAdapter, ready: function () { $("#dataTable").jqxDataTable('hideColumn', 'name'); }, columns: [ { text: 'Name', dataField: 'name', width: 250 }, { text: 'Beverage Type', dataField: 'type', width: 250 }, { text: 'Calories', dataField: 'calories', width: 180 }, { text: 'Total Fat', dataField: 'totalfat', width: 120 }, { text: 'Protein', dataField: 'protein', width: 100 }] }); ``` #### Example The sample code below shows how to use the `bindingComplete` event: ```javascript var url = "../sampledata/beverages.txt"; // prepare the data var source = { dataType: "json", dataFields: [ { name: 'name', type: 'string' }, { name: 'type', type: 'string' }, { name: 'calories', type: 'int' }, { name: 'totalfat', type: 'string' }, { name: 'protein', type: 'string' }], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#dataTable").on('bindingComplete', function (event) { $("#dataTable").jqxDataTable('hideColumn', 'name'); }); $("#dataTable").jqxDataTable( { width: 400, source: dataAdapter, columns: [ { text: 'Name', dataField: 'name', width: 250 }, { text: 'Beverage Type', dataField: 'type', width: 250 }, { text: 'Calories', dataField: 'calories', width: 180 }, { text: 'Total Fat', dataField: 'totalfat', width: 120 }, { text: 'Protein', dataField: 'protein', width: 100 }] }); ``` --- ### DataTable localization Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-localization.htm > jqxDataTable shows text of its own (the pager, the filter panel, the empty-table message, the loading indicator) and formats dates, numbers and currency in… jqxDataTable shows text of its own (the pager, the filter panel, the empty-table message, the loading indicator) and formats dates, numbers and currency in its cells. The `localization` property translates all of it. Pass an object with only the members you want to change; every member you leave out keeps its English default. #### 1. Translate the strings Set `localization` when you create the table. This example translates the pager and the messages into German: ```javascript const german = { pagerGoToPageString: 'Gehe zu:', pagerShowRowsString: 'Zeilen:', pagerRangeString: ' von ', pagerPreviousButtonString: 'zurück', pagerNextButtonString: 'weiter', pagerFirstButtonString: 'erste', pagerLastButtonString: 'letzte', filterApplyString: 'Anwenden', filterCancelString: 'Abbrechen', filterClearString: 'Filter löschen', filterSearchString: 'Suchen:', emptyDataString: 'Keine Daten vorhanden', loadText: 'Wird geladen …' }; $('#table').jqxDataTable({ width: 600, source: dataAdapter, pageable: true, localization: german, columns: [ { text: 'Produkt', dataField: 'product' }, { text: 'Datum', dataField: 'date', cellsFormat: 'D' }, { text: 'Preis', dataField: 'price', cellsFormat: 'c2', cellsAlign: 'right' } ] }); ``` Member names are not case-sensitive: `pagerGoToPageString` and `pagergotopagestring` are the same member. Column headers are not part of `localization`; translate them in each column's `text`. #### 2. Take the calendar and number formats from the browser Day and month names, the first day of the week, the decimal and thousands separators and the currency symbol already exist for every locale in the browser's `Intl` API. This helper builds those members from a locale code, so you only write the strings yourself: ```javascript // A jqWidgets localization object for a locale ('de-DE', 'fr-FR', 'ja-JP', ...), from Intl. // strings: your translated texts, merged over the generated members. function jqxLocalization(locale, { currency, strings = {} } = {}) { const utc = (y, m, d) => new Date(Date.UTC(y, m, d)); const fmt = options => new Intl.DateTimeFormat(locale, { timeZone: 'UTC', ...options }); // 1 January 2023 was a Sunday, so days 0-6 are Sunday to Saturday. const dayNames = style => [0, 1, 2, 3, 4, 5, 6].map(i => fmt({ weekday: style }).format(utc(2023, 0, 1 + i))); const monthNames = style => [...Array(12).keys()].map(i => fmt({ month: style }).format(utc(2023, i, 1))).concat(''); const number = new Intl.NumberFormat(locale).formatToParts(12345.6); const part = (parts, type) => parts.find(p => p.type === type)?.value ?? ''; const loc = new Intl.Locale(locale); const week = loc.getWeekInfo?.() ?? loc.weekInfo; const result = { firstDay: week ? week.firstDay % 7 : 0, // Intl counts 1 = Monday ... 7 = Sunday days: { names: dayNames('long'), namesAbbr: dayNames('short'), namesShort: dayNames('short').map(d => d.slice(0, 2)) }, months: { names: monthNames('long'), namesAbbr: monthNames('short') }, decimalseparator: part(number, 'decimal'), thousandsseparator: part(number, 'group') }; if (currency) { const money = new Intl.NumberFormat(locale, { style: 'currency', currency }).formatToParts(1); const types = money.map(p => p.type); result.currencysymbol = part(money, 'currency'); result.currencysymbolposition = types.indexOf('currency') < types.indexOf('integer') ? 'before' : 'after'; } return { ...result, ...strings }; } $('#table').jqxDataTable({ // ... localization: jqxLocalization('de-DE', { currency: 'EUR', strings: german }) }); ``` With `de-DE`, a date column with `cellsFormat: 'D'` shows *Samstag, März 14, 2026*, and a price with `cellsFormat: 'c2'` shows *1.234,50€*. The pager reads *1-2 von 2*. Browsers that don't report the first day of the week (`Intl.Locale` week info) get Sunday; pass `firstDay` in `strings` to set it yourself. The order of day, month and year comes from the `patterns` member, not from `Intl`. A `patterns` object replaces all the default patterns, so start from the defaults and change the ones you need: ```javascript const strings = { ...german, patterns: { ...$.jqx.dataFormat.defaultcalendar().patterns, d: 'dd.MM.yyyy', // 14.03.2026 D: 'dddd, d. MMMM yyyy' // Samstag, 14. März 2026 } }; $('#table').jqxDataTable({ /* ... */ localization: jqxLocalization('de-DE', { currency: 'EUR', strings }) }); ``` Passing only `patterns: { D:... }` removes the other patterns, and a column that uses one of them (such as `cellsFormat: 'd'`) then fails with "Invalid date format string". #### 3. Change the language while the page is open Set `localization` to the new object and render the table again: ```javascript $('#table').jqxDataTable({ localization: jqxLocalization('fr-FR', { currency: 'EUR', strings: { pagerRangeString: ' sur ' } }) }); $('#table').jqxDataTable('render'); ``` Setting the property alone keeps the old texts on screen until the next render. #### Localization members | Member | Default | Used for | | --- | --- | --- | | `pagerGoToPageString` | `"Go to page:"` | Pager: the page number input | | `pagerShowRowsString` | `"Show rows:"` | Pager: the page size list | | `pagerRangeString` | `" of "` | Pager: "1-10 of 50" | | `pagerPreviousButtonString`, `pagerNextButtonString` | `"previous"`, `"next"` | Pager buttons | | `pagerFirstButtonString`, `pagerLastButtonString` | `"first"`, `"last"` | Pager buttons | | `filterApplyString`, `filterCancelString`, `filterClearString` | `"Apply"`, `"Cancel"`, `"Clear Filter"` | Filter panel buttons | | `filterString` | `"advanced"` | Filter panel | | `filterSearchString` | `"Search:"` | Filter panel: the search box label | | `filterSelectString` | `"Select Filter"` | Filter panel: the condition list | | `filterStringComparisonOperators`, `filterNumericComparisonOperators`, `filterDateComparisonOperators`, `filterBooleanComparisonOperators` | English condition names ("contains", "equal",...) | Filter conditions, per column type. Translate each array in the order of its default, below. | | `emptyDataString` | `"No data to display"` | A table with no rows | | `loadText` | `"Loading..."` | The loading indicator | | `validationString` | `"Entered value is not valid"` | Editing: a rejected value | | `todayString`, `clearString` | `"Today"`, `"Clear"` | Date picker buttons | | `firstDay` | `0` | First day of the week (0 = Sunday) | | `days`, `months` | English names | `names`, `namesAbbr` (and `namesShort` for days); months have 13 entries, the last one empty | | `AM`, `PM` | `["AM", "am", "AM"]`, `["PM", "pm", "PM"]` | 12-hour times: standard, lower-case and upper-case forms | | `patterns` | US patterns (below) | Date formats that `cellsFormat` refers to | | `decimalSeparator`, `thousandsSeparator` | `"."`, `","` | Number formats (`n2`, `c2`, `p1`...) | | `currencySymbol`, `currencySymbolPosition` | `"$"`, `"before"` | Currency formats (`c0`, `c2`...); position is `"before"` or `"after"` | | `percentSymbol` | `"%"` | Percent formats (`p0`, `p2`...) | The filter condition defaults, in the order your translations must follow: ```javascript const englishFilterConditions = { filterStringComparisonOperators: ['empty', 'not empty', 'contains', 'contains(match case)', 'does not contain', 'does not contain(match case)', 'starts with', 'starts with(match case)', 'ends with', 'ends with(match case)', 'equal', 'equal(match case)', 'null', 'not null'], filterNumericComparisonOperators: ['equal', 'not equal', 'less than', 'less than or equal', 'greater than', 'greater than or equal', 'null', 'not null'], filterDateComparisonOperators: ['equal', 'not equal', 'less than', 'less than or equal', 'greater than', 'greater than or equal', 'null', 'not null'], filterBooleanComparisonOperators: ['equal', 'not equal'] }; ``` #### Date patterns A column's `cellsFormat` can name a pattern (`'d'`, `'D'`,...) or give one directly (`'dd.MM.yyyy'`). The named patterns and their defaults: | Name | Default | Example | | --- | --- | --- | | `d` | `M/d/yyyy` | 3/14/2026 | | `D` | `dddd, MMMM dd, yyyy` | Saturday, March 14, 2026 | | `t` | `h:mm tt` | 5:44 PM | | `T` | `h:mm:ss tt` | 5:44:10 PM | | `f` | `dddd, MMMM dd, yyyy h:mm tt` | Saturday, March 14, 2026 5:44 PM | | `F` | `dddd, MMMM dd, yyyy h:mm:ss tt` | Saturday, March 14, 2026 5:44:10 PM | | `M` | `MMMM dd` | March 14 | | `Y` | `yyyy MMMM` | 2026 March | | `S` | `yyyy'-'MM'-'dd'T'HH':'mm':'ss` | 2026-03-14T17:44:10 (sortable) | #### See also - [DataTable getting started](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-getting-started.htm) - [DataTable API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-api.htm): the `localization` property - [TreeGrid localization](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtreegrid/jquery-treegrid-localization.htm) (the same members) - [Grid localization](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-localization.htm) --- ### DataTable HTTP variables Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-extra-http-variables.htm > This help article illustrates how to send data to the server. The DataTable builds a Data object to be sent to the server which contains data about the… This help article illustrates how to send data to the server. The DataTable builds a Data object to be sent to the server which contains data about the DataTable's current page number, sort columns, sort order, etc. You can also add additional data variables. The data object passed by the widget is automatically converted to a query string by jQuery and it is appended to the url. #### Example with data object ```javascript // prepare the data const source = { datatype: "jsonp", datafields: [ { name: 'countryName' }, { name: 'name' }, { name: 'population', type: 'float' }, { name: 'continentCode' }], url: "http://ws.geonames.org/searchJSON", data: { featureClass: "P", style: "full", maxRows: 50 } }; ``` The data is converted into a query string automatically though the `jQuery.param()` method. The above code is appropriate only for static data. Default variables sent by jQWidgets DataTable: - sortdatafield - the sort column's datafield. - sortorder - the sort order - 'asc', 'desc' or '' - pagenum - the current page's number when the paging feature is enabled. - pagesize - the page's size which represents the number of rows displayed in the view. - filterslength - the number of filters applied to the DataTable - filtervalue - the filter's value. The filtervalue name for the first filter is "filtervalue0", for the second filter is "filtervalue1" and so on. - filtercondition - the filter's condition. The condition can be any of these: "CONTAINS", "DOES_NOT_CONTAIN", "EQUAL", "EQUAL_CASE_SENSITIVE", NOT_EQUAL","GREATER_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN", "LESS_THAN_OR_EQUAL", "STARTS_WITH", "STARTS_WITH_CASE_SENSITIVE", "ENDS_WITH", "ENDS_WITH_CASE_SENSITIVE", "NULL", "NOT_NULL", "EMPTY", "NOT_EMPTY" - filterdatafield - the filter column's datafield - filteroperator - the filter's operator - 0 for "AND" and 1 for "OR" Before the data is sent to the server, you can use the `formatData` function of the jqxDataAdapter. The result returned by the `formatData` function will be sent to the server. The `formatData` function is appropriate for scenarios with dynamic parameters. #### Example with formatData ```javascript var source = { datatype: "jsonp", datafields: [ { name: 'countryName', type: 'string' }, { name: 'name', type: 'string' }, { name: 'population', type: 'float' }, { name: 'continentCode', type: 'string' }], url: "http://ws.geonames.org/searchJSON" }; var dataAdapter = new $.jqx.dataAdapter(source, { formatData: function (data) { $.extend(data, { featureClass: "P", style: "full", maxRows: 50 }); return data; } } ); ``` The parameter passed to the `formatData` function represents the data object which includes all settings defined by you in the source object's `data` member and all default settings of the DataTable('sortdatafield', 'sortorder', etc.). #### Example with Server Paging, Sorting & Filtering ```javascript // prepare the data var source = { dataType: "json", dataFields: [ { name: 'ShipCountry', type: 'string' }, { name: 'ShipCity', type: 'string' }, { name: 'ShipAddress', type: 'string' }, { name: 'ShipName', type: 'string' }, { name: 'Freight', type: 'number' }, { name: 'ShippedDate', type: 'date' }], root: 'value', url: "http://services.odata.org/V3/Northwind/Northwind.svc/Orders?$format=json" }; var filterChanged = false; var dataAdapter = new $.jqx.dataAdapter(source, { formatData: function (data) { if (data.sortdatafield && data.sortorder) { // update the $orderby param of the OData service. // data.sortdatafield - the column's datafield value(ShipCountry, ShipCity, etc.). // data.sortorder - the sort order(asc or desc). data.$orderby = data.sortdatafield + " " + data.sortorder; } if (data.filterslength) { filterChanged = true; let filterParam = ""; for (let i = 0; i < data.filterslength; i++) { // filter's value. var filterValue = data["filtervalue" + i]; // filter's condition. For the filterMode="simple" it is "CONTAINS". var filterCondition = data["filtercondition" + i]; // filter's data field - the filter column's datafield value. var filterDataField = data["filterdatafield" + i]; // "and" or "or" depending on the filter expressions. When the filterMode="simple", the value is "or". var filterOperator = data[filterDataField + "operator"]; var startIndex = 0; if (filterValue.indexOf('-') == -1) { if (filterCondition == "CONTAINS") { filterParam += "substringof('" + filterValue + "', " + filterDataField + ") eq true"; filterParam += " " + filterOperator + " "; } } else { if (filterDataField == "ShippedDate") { var dateGroups = new Array(); var startIndex = 0; var item = filterValue.substring(startIndex).indexOf('-'); while (item > -1) { dateGroups.push(filterValue.substring(startIndex, item + startIndex)); startIndex += item + 1; item = filterValue.substring(startIndex).indexOf('-'); if (item == -1) { dateGroups.push(filterValue.substring(startIndex)); } } if (dateGroups.length == 3) { filterParam += "year(ShippedDate) eq " + parseInt(dateGroups[0]) + " and month(ShippedDate) eq " + parseInt(dateGroups[1]) + " and day(ShippedDate) eq " + parseInt(dateGroups[2]); } filterParam += " " + filterOperator + " "; } } } // remove last filter operator. filterParam = filterParam.substring(0, filterParam.length - filterOperator.length - 2); data.$filter = filterParam; source.totalRecords = 0; } else { if (filterChanged) { source.totalRecords = 0; filterChanged = false; } } if (source.totalRecords) { // update the $skip and $top params of the OData service. // data.pagenum - page number starting from 0. // data.pagesize - page size data.$skip = data.pagenum * data.pagesize; data.$top = data.pagesize; } return data; }, downloadComplete: function (data, status, xhr) { if (!source.totalRecords) { source.totalRecords = data.value.length; } } } ); $("#dataTable").jqxDataTable( { width: 670, pageable: true, pagerButtonsCount: 10, serverProcessing: true, source: dataAdapter, altRows: true, filterable: true, filterMode: 'simple', sortable: true, columnsResize: true, columns: [ { text: 'Ship Name', dataField: 'ShipName', width: 200 }, { text: 'Ship Country', dataField: 'ShipCountry', width: 200 }, { text: 'Ship City', dataField: 'ShipCity', width: 200 }, { text: 'Ship Address', dataField: 'ShipAddress', width: 200 }, { text: 'Ship Date', dataField: 'ShippedDate', width: 200, cellsFormat: 'yyyy-MM-dd' }] }); ``` - To enable the server processing of jqxDataTable, you need to set `serverProcessing` to true. - In server processing mode, jqxDataTable will make a data request on each Page change, Sort Order change or Filter change. - The source object's `totalRecords` member determines the records count. That parameter is used by the widget's Pager to display the correct amount of Pager buttons and to allow the end-user to navigate to a given page. - The sample uses data from [http://www.odata.org](http://www.odata.org/). OData is a standardized protocol for creating and consuming data APIs. OData builds on core protocols like HTTP and commonly accepted methodologies like REST. The result is a uniform way to expose full-featured data APIs. - The data variables `$skip, $top, $orderby, $filter, year, eq, year, month, day` are specific to the concrete sample and OData. They are not part of the jqxDataTable API. --- ### jQuery DataTable Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-styling-and-appearance.htm > Style the jQuery DataTable: the jqxDataTable CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxDataTable. - jqx-widget - applied to the DataTable widget. - jqx-grid - applied to DataTable container element. - jqx-grid-pager - applied to the DataTable Pager. - jqx-grid-header- applied to DataTable Columns container element. - jqx-grid-column-header - applied to a DataTable column. - jqx-widget-header - applied to a DataTable column, Toolbar, Statusbar and Groups Header. - jqx-widget-content - applied to the DataTable's content area. - jqx-grid-content - applied to the DataTable's content area. - jqx-grid-toolbar - applied to the toolbar. - jqx-grid-statusbar - applied to the statusbar. - jqx-cell - applied to the DataTable cells. - jqx-grid-cell - applied to the DataTable cells. - jqx-grid-cell-locked - applied to DataTable cells in a locked row. - jqx-grid-cell-sort - applied to the DataTable cells in the sort column. - jqx-grid-cell-filter - applied to the DataTable cells in the filter column. - jqx-grid-cell-alt - alternating cells style. This is applied to the cells in the alternating rows. - jqx-grid-cell-pinned - applied to the cells in a pinned column. - jqx-grid-cell-selected - applied to a selected cell. - jqx-fill-state-pressed - applied to a selected cell. - jqx-grid-cell-hover - applied to a hovered cell. - jqx-fill-state-hover - applied to a hovered cell. - jqx-grid-column-resizeline - applied to the column's resize line. - jqx-grid-column-resizestartline - applied to the column's resize start line. - jqx-fill-state-disabled - applied to the widget when it is disabled. - jqx-grid-group-drag-line - applied to the drop line indicators displayed in the grouping header. - jqx-grid-group-column-line - applied to the lines between the group columns. - jqx-right-align - applied to the content in cells depending on the column's `cellsAlign` value. Aligns the cell's content to the right. - jqx-left-align - applied to the content in cells depending on the column's `cellsAlign` value. Aligns the cell's content to the left. - jqx-center-align - applied to the content in cells depending on the column's `cellsAlign` value. Aligns the cell's content to the center. When you create a custom style with colors and backgrounds for jqxDataTable, you need to do the following: - Add the above CSS classes related to jqxDataTable - After each CSS class, add your theme name. For example: jqx-grid-energyblue - To apply your custom style to jqxDataTable, you need to set its 'theme' property(option) to point to your theme's name. - The sample below demonstrates how to set the 'Energy Blue' theme to jqxDataTable. ```html Apply a Theme to jQWidgets DataTable
``` --- ### jQuery DataTable API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdatatable.txt #### Properties - `altRows` (Type: Boolean, Default: false): Sets or gets whether the jqxDataTable automatically alternates row colors. - `autoRowHeight` (Type: Boolean, Default: true): Sets or gets whether the jqxDataTable automatically calculates the rows height and wraps the cell text. - `aggregatesHeight` (Type: Number, Default: 34): Sets or gets the height of the aggregates bar. Aggregates bar is displayed after setting `showAggregates` to true. - `autoShowLoadElement` (Type: Boolean, Default: true): Sets or gets whether the loading html element with animated gif is automatically displayed by the widget during the data binding process. - `columnsHeight` (Type: Number, Default: 30): Sets or gets the height of the columns header. - `columns` (Type: Array, Default: []): Sets the jqxDataTable's columns. - `columnGroups` (Type: Array, Default: []): Sets the jqxDataTable's column groups. - `columnsResize` (Type: Boolean, Default: false): Sets or gets the jqxDataTable's columnsResize. - `columnsReorder` (Type: Boolean, Default: false): Sets or gets the jqxDataTable's columnsReorder. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the jqxDataTable is disabled. - `editable` (Type: Boolean, Default: false): Sets or gets whether the jqxDataTable editing is enabled. - `editSettings` (Type: Object, Default: { saveOnPageChange: true, saveOnBlur: true, saveOnSelectionChange: true, cancelOnEsc: true, saveOnEnter: true, editSingleCell: false, editOnDoubleClick: true, editOnF2: true }): Sets or gets the jqxDataTable's edit settings. - `exportSettings` (Type: Object, Default: { columnsHeader: true, hiddenColumns: false, serverURL: null, characterSet: null, recordsInView: true, fileName: "jqxDataTable"}): Determines the Data Export settings used by jqxDataTable when `exportData` is called. See also the `exportData` method. - `enableHover` (Type: Boolean, Default: true): Sets or gets whether row highlighting is enabled. - `enableBrowserSelection` (Type: Boolean, Default: false): Enables or disables the default text selection of the web browser. - `filterable` (Type: Boolean, Default: false): Enables/Disables the filtering feature. - `filterHeight` (Type: Number, Default: 30): Sets or gets the Filter Element's height. - `filterMode` (Type: String, Default: "default"): Determines the Filter's mode. Possible values: `"default"`, `"simple"` and `"advanced"` - `groups` (Type: Array, Default: []): Sets or gets the jqxDataTable's data groups. Set this property if you want to display the data grouped by a set of column(s). - `groupsRenderer` (Type: Function, Default: null): Callback function which allows you to customize the rendering of the group headers. - `height` (Type: Number/String, Default: null): Sets or gets the jqxDataTable's height. - `initRowDetails` (Type: Function, Default: null): Callback function which is used for initialization of the expanded row's details. The function is called just once when the row is expanded for first time. - `incrementalSearch` (Type: Boolean, Default: true): Determines whether the incremental search is enabled. The feature allows you to quickly find and select data records by typing when the widget is on focus. - `localization` (Type: Object, Default: default localization strings.): Applies a localization to the jqxDataTable's Strings. - `pagerHeight` (Type: Number, Default: 28): Sets or gets the height of the jqxDataTable's Pager(s). Pager(s) is(are) displayed after setting `pageable` to true. - `pageSize` (Type: Number, Default: 10): Sets or gets the rows count per page when paging is enabled. - `pageSizeOptions` (Type: Array, Default: ['5', '10', '20']): Sets or gets the jqxDataTable's page size options when paging is enabled and the `pagerMode` property is set to `"advanced"`. - `pageable` (Type: Boolean, Default: false): Determines whether the jqxDataTable is in paging mode. - `pagerPosition` (Type: String, Default: "bottom"): Sets or gets the Pager's position. Possible values: `'top'`, `'bottom'` and `'both'` - `pagerMode` (Type: String, Default: "default"): Sets or gets the Pager's mode. Possible values: `"default"` and `"advanced"` - `pagerButtonsCount` (Type: Number, Default: 5): Sets or gets the count of the buttons displayed on the Pager when `pagerMode` is set to `"default"`. - `pagerRenderer` (Type: Function, Default: null): Enables custom rendering of the Pager. - `ready` (Type: Function, Default: null): Callback function which is called when the jqxDataTable is rendered and data binding is completed.. - `rowDetails` (Type: Boolean, Default: false): Sets or gets whether the jqxDataTable rows have details and can be expanded/collapsed. See the `initRowDetails` for initialization of the row details. - `renderToolbar` (Type: Function, Default: null): Enables custom rendering of the Toolbar. - `renderStatusBar` (Type: Function, Default: null): Enables custom rendering of the Statusbar. - `renderStatusbar` (Type: Function, Default: null): Enables custom rendering of the Statusbar. - `rendering` (Type: Function, Default: null): Callback function which is called before the rendering of the jqxDataTable's rows. - `rendered` (Type: Function, Default: null): Callback function which is called after the rendering of the jqxDataTable's row. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `source` (Type: Object, Default: null): Determines the jqxDataTable's data source. The `source` property is expected to point to an instance of jqxDataAdapter. For more information about jqxDataAdapter, visit: jquery-data-adapter.htm. - `sortable` (Type: Boolean, Default: false): Enables/Disables the sorting feature. - `showAggregates` (Type: Boolean, Default: false): Determines whether the jqxDataTable's Aggregates bar is visible. - `showToolbar` (Type: Boolean, Default: false): Determines whether the jqxDataTable's Toolbar is visible. - `showStatusbar` (Type: Boolean, Default: false): Determines whether the jqxDataTable's Statusbar is visible. - `enableSanitizeAll` (Type: Boolean, Default: false): Determines whether the jqxDataTable's HTML escape of chars is enabled. - `statusBarHeight` (Type: Number, Default: 34): Sets or gets the height of the Statusbar. Statusbar is displayed after setting `showStatusbar` to true. - `scrollBarSize` (Type: Number, Default: 17): Sets or gets the size of the scrollbars. - `selectionMode` (Type: String, Default: "multipleRows"): Sets or gets the selection mode. Possible values: `"multipleRows"`, `"singleRow"` and `"custom"`. In the "custom" mode, rows could be selected/unselected only through the API. - `serverProcessing` (Type: Boolean, Default: false): Sets or gets whether the Paging, Sorting and Filtering are handled by a Server and jqxDataTable sends Ajax requests to a Server and displays the returned data. - `showHeader` (Type: Boolean, Default: true): Sets or gets the jqxDataTable's columns visibility. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `toolbarHeight` (Type: Number, Default: 34): Sets or gets the height of the Toolbar. Toolbar is displayed after setting `showToolbar` to true. - `width` (Type: Number/String, Default: null): Sets or gets the jqxDataTable's width. #### Events - `bindingComplete` (Type: Event): This event is triggered when the jqxDataTable binding is completed. *Bind to that event before the jqxDataTable's initialization. - `cellBeginEdit` (Type: Event): This is triggered when a cell edit begins. Note: To turn on cell editing, you should set the `editSettings` property and make sure that its `editSingleCell` sub property is set to `true`. - `cellEndEdit` (Type: Event): This is triggered when a cell edit ends. Note: To turn on cell editing, you should set the `editSettings` property and make sure that its `editSingleCell` sub property is set to `true`. - `cellValueChanged` (Type: Event): This event is triggered when a cell value is changed. - `columnResized` (Type: Event): This event is triggered when a column is resized. - `columnReordered` (Type: Event): This event is triggered when the column's order is changed. - `sort` (Type: Event): This event is triggered when the jqxDataTable sort order or sort column is changed. - `filter` (Type: Event): This event is triggered when the jqxDataTable's rows filter is changed. - `pageChanged` (Type: Event): This is triggered when the jqxDataTable's current page is changed. - `pageSizeChanged` (Type: Event): This is triggered when the jqxDataTable's page size is changed. - `rowClick` (Type: Event): This is triggered when a row is clicked. - `rowDoubleClick` (Type: Event): This is triggered when a row is double-clicked. - `rowSelect` (Type: Event): This is triggered when a row is selected. - `rowUnselect` (Type: Event): This is triggered when a row is unselected. - `rowBeginEdit` (Type: Event): This is triggered when a row edit begins. - `rowEndEdit` (Type: Event): This is triggered when a row edit ends. - `rowExpand` (Type: Event): This is triggered when a row is expanded. - `rowCollapse` (Type: Event): This is triggered when a row is collapsed. #### Methods - `addRow` (Type: Method): Adds a new row. For synchronization with a server, please look also the jqxDataAdapter plug-in's help documentation. - `addFilter` (Type: Method): Adds a new filter. - `applyFilters` (Type: Method): Applies the added/removed filters. - `beginUpdate` (Type: Method): Begins an update and stops all refreshes. - `beginRowEdit` (Type: Method): Begins a row edit operation when `editable` is set to true. - `beginCellEdit` (Type: Method): Begins a cell edit operation when `editable` is set to true. - `clearSelection` (Type: Method): Clears the selection. - `clearFilters` (Type: Method): Clears the filters. - `clear` (Type: Method): Clears the jqxDataTable. - `destroy` (Type: Method): Destroys jqxDataTable and removes it from the DOM. - `deleteRow` (Type: Method): Deletes a row. For synchronization with a server, please look also the jqxDataAdapter plug-in's help documentation. - `endUpdate` (Type: Method): Ends the update and resumes all refreshes. - `ensureRowVisible` (Type: Method): Moves the vertical scrollbar to a row index. - `endRowEdit` (Type: Method): Ends a row edit when `editable` is set to true. - `endCellEdit` (Type: Method): Ends a cell edit operation when `editable` is set to true. - `exportData` (Type: Method): Exports jqxDataTable's data to Excel, HTML, XML, JSON, CSV or TSV. See also the `exportSettings` property - `focus` (Type: Method): Focus jqxDataTable. - `getColumnProperty` (Type: Method): Gets a property value of a column. - `goToPage` (Type: Method): Navigates to a page when `pageable` is set to true. - `goToPrevPage` (Type: Method): Navigates to a previous page when `pageable` is set to true. - `goToNextPage` (Type: Method): Navigates to a next page when `pageable` is set to true. - `getSelection` (Type: Method): Returns an array of selected rows. - `getRows` (Type: Method): Returns an array of all rows loaded in the widget. - `getView` (Type: Method): Returns an array of all rows displayed in the view. This method takes into account the Sorting Order and returns the Filtered Set of Rows, if Filtering is applied. - `getCellValue` (Type: Method): Returns a value of a cell. - `hideColumn` (Type: Method): Hides a column. - `hideDetails` (Type: Method): Hides the details of a row. - `isBindingCompleted` (Type: Method): Returns whether the binding is completed and if the result is true, this means that you can invoke methods and set properties. - `lockRow` (Type: Method): Locks a row i.e editing of the row would be disabled. - `refresh` (Type: Method): Performs a layout and updates the HTML elements position and size. - `render` (Type: Method): Renders jqxDataTable. - `removeFilter` (Type: Method): Removes a filter. - `scrollOffset` (Type: Method): Scrolls to a position. - `setColumnProperty` (Type: Method): Sets a property of a column. See the `columns` property for more information. - `showColumn` (Type: Method): Shows a column. - `selectRow` (Type: Method): Selects a row. - `showDetails` (Type: Method): Shows a row details. - `setCellValue` (Type: Method): Sets a value of a cell. - `sortBy` (Type: Method): Sorts a column, if `sortable` is set to true. - `updating` (Type: Method): Gets a boolean value which determines whether jqxDataTable is in update state i.e the `beginUpdate` method was called and the `endUpdate` method is not called yet. - `updateBoundData` (Type: Method): Performs a data bind and updates jqxDataTable with the new data. - `unselectRow` (Type: Method): Unselects a row. - `updateRow` (Type: Method): Updates the row's data. For synchronization with a server, please look also the jqxDataAdapter plug-in's help documentation. - `unlockRow` (Type: Method): Unlocks a row. --- ### jQuery DateTimeInput Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatetimeinput/jquery-datetimeinput-getting-started.htm > jQuery DateTimeInput getting started: install jQWidgets, add jqxDateTimeInput to your app, see a complete example, then handle its events and call its methods. jqxDateTimeInput represents a jQuery datetimeinput widget that enables the user to select a date or time using a popup calendar display or by keyboard input into the text field. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `5` scripts, listed below - **Demos:** [jQuery DateTimeInput demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatetimeinput/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatetimeinput/jquery-datetimeinput-api.htm) jqxDateTimeInput in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatetimeinput/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the DateTimeInput's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#dateTimeInput').jqxDateTimeInput({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatetimeinput/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxDateTimeInput widget requires the following files: ```html ``` The next step is to create html element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxDateTimeInput’s constructor. ```javascript $("#jqxdatetimeinput").jqxDateTimeInput(‘setDate’, new Date(2026, 0, 26)); ``` To get the result of a function after calling it, you can use the following syntax: ```javascript var selectedDate = $("#jqxdatetimeinput'").jqxDateTimeInput(‘getDate’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxDateTimeInput's constructor. ```javascript $("#jqxdatetimeinput").jqxDateTimeInput({ formatString: "dd/MM/yyyy" }); ``` To get a property(option), you need to pass the property name to the jqxDateTimeInput's constructor. ```javascript const formatstring = $("#jqxdatetimeinput").jqxDateTimeInput('formatString'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the selected date after the user clicks on a calendar cell or enters it manually with the keyboard. The example code below demonstrates how to bind to the ‘change’ event of jqxDateTimeInput. ```javascript $('#jqxDateTimeInput').on('change', function (event) { const date = event.args.date; }); ``` #### Basic Sample ```html jQuery DateTimeInput Sample
``` --- ### jQuery DateTimeInput Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatetimeinput/jquery-datetimeinput-styling-and-appearance.htm > Style the jQuery DateTimeInput: the jqxDateTimeInput CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxDateTimeInput. - jqx-input - applied to jqxDateTimeInput widget. - jqx-input-content - applied to the input's content. - jqx-widget-content - applied to the input's content. - jqx-input-disabled - applied to the input when it is disabled. - jqx-input-button-header - applied to the jqxDateTimeInput's button header. - jqx-widget-header - applied to the jqxDateTimeInput's button header. - jqx-input-button-innerHeader - applied to the element which is in the middle of the jqxDateTimeInput's button header. - jqx-input-button-content- applied to the jqxDateTimeInput's button content. - jqx-fill-state-focus - applied to the jqxDateTimeInput when it is focused. - jqx-fill-state-disabled - applied to the jqxDateTimeInput when it is disabled. *jqxDateTimeInput internally use the jqxCalendar widget. For additional information about styling jqxCalendar, please take a look at the jqxCalendar's Styling and Appearance help topic. When you create a custom style with colors and backgrounds for jqxDateTimeInput, you need to do the following: - Add the above CSS classes related to jqxDateTimeInput - After each CSS class, add your theme name. For example: jqx-input-themename - To apply your custom style to jqxDateTimeInput, you need to set its 'theme' property(option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Summer' theme to jqxDateTimeInput. ```html jQuery DateTimeInput CSS Styling and Appearance Sample
``` --- ### jQuery DateTimeInput API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatetimeinput/jquery-datetimeinput-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdatetimeinput.txt #### Properties - `animationType` (Type: String, Default: 'slide'): Sets or gets the type of the animation. - `allowNullDate` (Type: Boolean, Default: true): Determines whether Null is allowed as a value. - `allowKeyboardDelete` (Type: Boolean, Default: true): Determines whether `Backspace` and `Delete` keys are handled by the widget. - `clearString` (Type: String, Default: 'Clear'): Sets or gets the 'Clear' string displayed when the 'showFooter' property is true. - `culture` (Type: String, Default: default): Sets or gets the jqxDateTimeInput's culture. The culture settings are contained within a file with the language code appended to the name, e.g. jquery.glob.de-DE.js for German. - `closeDelay` (Type: Number, Default: 400): Specifies the animation duration of the popup calendar when it is going to be hidden. - `closeCalendarAfterSelection` (Type: Boolean, Default: true): Sets or gets whether or not the popup calendar must be closed after selection. - `dropDownHorizontalAlignment` (Type: String, Default: 'left'): Sets the DropDown's alignment. - `dropDownVerticalAlignment` (Type: String, Default: 'bottom'): Sets or gets the DropDown's alignment. - `disabled` (Type: Boolean, Default: false): Determines whether the widget is disabled. - `enableBrowserBoundsDetection` (Type: Boolean, Default: false): When this property is set to true, the popup calendar may open above the input, if there's not enough space below the DateTimeInput. - `enableAbsoluteSelection` (Type: Boolean, Default: false): This setting enables the user to select only one symbol at a time when typing into the text input field. - `editMode` (Type: String, Default: 'default'.): Sets the edit mode of the component. Possible values: 'default', 'full'. In 'default' mode, value is always displayed and is validated on each key press. - `firstDayOfWeek` (Type: Number, Default: 0): Sets or gets which day to display in the first day column. By default the calendar displays 'Sunday' as first day. - `formatString` (Type: String, Default: dd/MM/yyyy): Sets or gets the date time input format of the date. - `height` (Type: Number/String, Default: null): Sets or gets the height of the jqxDateTimeInput widget. - `min` (Type: Date, Default: Date(1900, 1, 1)): Sets or gets the jqxDateTimeInput's minimum date. - `max` (Type: Date, Default: Date(2100, 1, 1)): Sets or gets the jqxDateTimeInput's maximum date. - `openDelay` (Type: Number, Default: 350): Specifies the animation duration of the popup calendar when it is going to be displayed. - `placeHolder` (Type: String, Default: ""): Determines the widget's place holder displayed when the widget's value is null. - `popupZIndex` (Type: Number, Default: 20000): Sets or gets the popup's z-index. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `readonly` (Type: Boolean, Default: false) - `showFooter` (Type: Boolean, Default: false): Sets or gets a value indicating whether the dropdown calendar's footer is displayed. - `selectionMode` (Type: String, Default: 'default'): Sets or gets the dropdown calendar's selection mode. - `showWeekNumbers` (Type: Boolean, Default: true): Sets or gets a value whether the week`s numbers are displayed. - `showTimeButton` (Type: Boolean, Default: false): Determines whether the time button is visible. - `showCalendarButton` (Type: Boolean, Default: true): Determines whether the calendar button is visible. - `showDeleteButton` (Type: boolean, Default: false): Determines whether the delete button is visible. - `template` (Type: String, Default: 'default'): Determines the template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `textAlign` (Type: String, Default: left): Sets or gets the position of the text. - `todayString` (Type: String, Default: 'Today'): Sets or gets the 'Today' string displayed in the dropdown Calendar when the 'showFooter' property is true. - `value` (Type: Date, Default: Today's Date): Sets or gets the jqxDateTimeInput value. - `width` (Type: Number/String, Default: null): Sets or gets the width of the jqxDateTimeInput widget. - `yearCutoff` (Type: Number, Default: null): Sets or gets the yearCutoff of the jqxDateTimeInput widget. This property is used with the Full edit mode. #### Events - `change` (Type: Event): This event is triggered on blur when the value is changed. - `close` (Type: Event): This event is triggered when the popup calendar is closed. - `open` (Type: Event): This event is triggered when the popup calendar is opened. - `textchanged` (Type: Event): This event is triggered when the text is changed. - `valueChanged` (Type: Event): This event is triggered when the value is changed. #### Methods - `close` (Type: Method): After calling this method, the popup calendar will be hidden. - `destroy` (Type: Method): Destroys the widget. - `focus` (Type: Method): Focuses the widget. - `getRange` (Type: Method): Gets the selection range when the selectionMode is set to 'range'. The returned value is an Object with "from" and "to" fields. Each of the fields is a JavaScript Date Object. - `getText` (Type: Method): Returns the input field's text. - `getDate` (Type: Method): When the getDate method is called, the user gets the current date. The returned value is JavaScript Date Object. - `getMaxDate` (Type: Method): When the setMaxDate method is called, the user gets the maximum navigation date. The returned value is JavaScript Date Object. - `getMinDate` (Type: Method): When the getMinDate method is called, the user gets the minimum navigation date. The returned value is JavaScript Date Object. - `open` (Type: Method): After calling this method, the popup calendar will be displayed. - `setRange` (Type: Method): Sets the selection range when the selectionMode is set to 'range'. The required parameters are JavaScript Date Objects. - `setMinDate` (Type: Method): When the setMinDate method is called, the user sets the minimum date to which it is possible to navigate. - `setMaxDate` (Type: Method): When the setMaxDate method is called, the user sets the maximum date to which it is possible to navigate. - `setDate` (Type: Method): When the setDate method is called, the user sets the date. The required parameter is a JavaScript Date Object. - `val` (Type: Method): Gets or sets the jqxDateTimeInput's value. --- ### jQuery Docking Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdocking/jquery-docking-getting-started.htm > jQuery Docking getting started: install jQWidgets, add jqxDocking to your app, see a complete example, then handle its events and call its methods. jqxDocking represents a JavaScript component which allows you to manage multiple windows and even the layout of your web page. Each window in the jqxDocking can be dragged around the Web page, docked into docking zones, removed from the docking, collapsed into a minimized state to hide its content, expanded to display its content or pinned in place. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `13` scripts, listed below - **Demos:** [jQuery Docking demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdocking/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdocking/jquery-docking-api.htm) jqxDocking in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdocking/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Docking's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#docking').jqxDocking({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdocking/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and CSS dependencies to your project. The jqxDocking widget requires the following files: ```html ``` The next step is to create a DIV element within the body of the html document. ```html
Header 1
Content 1
Header 2
Content 2
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` The upper code is going to create a jqxDocking widget with the classic theme and width 300px. To call a function(method), you need to pass the method name and parameters(if any) in the jqxDocking’s constructor. ```javascript $('#docking').jqxDocking('disableWindowResize', 'window1'); ``` To get the result of a function(method) call, you need to pass the method name in the jqxDocking’s constructor and parameters(if any). ```javascript var value = $("#docking").jqxDocking(‘exportLayout’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxDocking's constructor. ```javascript $("#docking").jqxDocking({ floatingWindowOpacity: 0.4 }); ``` To get a property(option), you need to pass the property name to the jqxDocking's constructor. ```javascript const dockingMode = $("#docking").jqxDocking('mode'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the tooltip is displayed. The example code below demonstrates how to bind to the ‘dragEnd’ event of jqxDocking. ```javascript $("#docking").on('dragEnd', function () { }); ``` #### Basic Sample ```html jQuery jqxDocking Sample
Header 1
Content 1
Header 2
Content 2
``` --- ### jQuery Docking Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdocking/jquery-docking-styling-and-appearance.htm > Style the jQuery Docking: the jqxDocking CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxDocking. - jqx-docking - applied to the docking's main div. - jqx-docking-panel - applied to the different docking panels. - jqx-docking-drop-indicator - applied to the jqxdocking's drop indicator. - jqx-docking-window - applied to the windows which are inside the docking. *jqxDocking internally use the jqxWindow widget. For additional information about styling jqxWindow, please take a look at the jqxWindow's Styling and Appearance help topic. When you create a custom style with colors and backgrounds for jqxDocking panels, you need to do the following: - Add the above CSS classes related to jqxDocking - After each CSS class, add your theme name. For example: jqx-docking-panel-shinyblack - To apply your custom style to jqxDocking, you need to set its 'theme' property (option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Shiny Black' theme to jqxDocking. ```html jQuery jqxDocking Sample
Header 1
Content 1
Header 2
Content 2
``` --- ### jQuery Docking API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdocking/jquery-docking-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdocking.txt #### Properties - `cookies` (Type: Boolean, Default: false): Enables or disables the cookies. If the cookies are enabled then the docking layout is going to be saved and kept every time the page is being reloaded. - `cookieOptions` (Type: Object, Default: {}): Sets or gets the cookie options. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the docking is disabled. - `floatingWindowOpacity` (Type: Number, Default: 0.3): Sets or gets the opacity of the window which is currently dragged by the user. - `height` (Type: Number/String, Default: auto): Sets or gets the docking's height. - `keyboardNavigation` (Type: Boolean, Default: false): Enables or disables the jqxDocking's keyboard navigation. - `mode` (Type: String, Default: default): Sets or gets docking's mode. - `orientation` (Type: String, Default: horizontal): Sets or gets docking's orientation. This property is setting whether the panels are going to be side by side or below each other. - `rtl` (Type: Boolean, Default: false): Sets ot gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `width` (Type: Number/String, Default: auto): Sets or gets the docking's width. - `windowsMode` (Type: Object, Default: null): Sets ot gets specific mode for each window. The value of the property is object with keys - window's ids and values - specific modes. - `windowsOffset` (Type: Number, Default: 5): Sets or gets the offset between the windows. #### Events - `dragStart` (Type: Event): This event is triggered when the user start to drag any window. - `dragEnd` (Type: Event): This event is triggered when the user drop any window. #### Methods - `addWindow` (Type: Method): Adding new window to the docking. This method accepts four arguments. The first one is id of the window we wish to add to the docking. - `closeWindow` (Type: Method): Closing specific window. - `collapseWindow` (Type: Method): Collapsing a specific window. - `destroy` (Type: Method): Destroys the widget. - `disableWindowResize` (Type: Method): Disabling the resize of a specific window. - `disable` (Type: Method): Disabling the jqxDocking. - `exportLayout` (Type: Method): Exporting docking's layout into a JSON string. - `enable` (Type: Method): Enabling the docking - `expandWindow` (Type: Method): Expanding a specific window. - `enableWindowResize` (Type: Method): Enabling the resize of a specific window which is not docked into a panel. - `focus` (Type: Method): Focuses the widget. - `hideAllCloseButtons` (Type: Method): Hiding the close buttons of all windows. - `hideAllCollapseButtons` (Type: Method): Hiding the collapse buttons of all windows. - `hideCollapseButton` (Type: Method): Hiding the collapse button of a specific window. - `hideCloseButton` (Type: Method): Hiding the close button of a specific window. - `importLayout` (Type: Method): Importing the docking layout from a JSON string. - `move` (Type: Method): Moving window to specific position into specific panel. This method have three parameters. - `pinWindow` (Type: Method): Pinning a specific window - `setWindowMode` (Type: Method): Setting mode to a specific window. This method accepts two arguments - window id and mode type. - `showCloseButton` (Type: Method): Showing the close button of a specific window. - `showCollapseButton` (Type: Method): Showing the collapse button of a specific window. - `setWindowPosition` (Type: Method): Moving window in floating mode to a specific position. - `showAllCloseButtons` (Type: Method): Showing the close buttons of all windows. - `showAllCollapseButtons` (Type: Method): Showing the collapse buttons of all windows. - `unpinWindow` (Type: Method): Unpinning a specific window --- ### jQuery DockingLayout Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockinglayout/jquery-docking-layout-getting-started.htm > jQuery DockingLayout getting started: install jQWidgets, add jqxDockingLayout to your app, see a complete example, then handle its events and call its methods. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxDockingLayout widget requires the following files: #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `6` scripts, listed below - **Demos:** [jQuery DockingLayout demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdockinglayout/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockinglayout/jquery-docking-layout-api.htm) jqxDockingLayout in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdockinglayout/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the DockingLayout's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#dockingLayout').jqxDockingLayout({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdockinglayout/index.htm) show every option with its source code; the guide below explains them. ```html ``` ```html
List of tools
Help topics
Document 1 content
Document 2 content
List of errors
Solution structure
List of properties
Output
``` ```html ``` ```javascript $("#jqxDockingLayout").jqxDockingLayout("destroy"); ``` ```javascript $("#jqxDockingLayout").jqxDockingLayout({ rtl: true }); ``` ```javascript const width = $("#jqxDockingLayout").jqxDockingLayout("width"); ``` ```javascript // bind to resize event. $('#jqxDockingLayout').on('resize', function () { alert('A panel group has been resized.'); }); ``` #### Basic Sample ```html jQuery Docking Layout Sample
List of tools
Help topics
Document 1 content
Document 2 content
List of errors
Solution structure
List of properties
Output
``` --- ### jQuery DockingLayout Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockinglayout/jquery-docking-layout-styling-and-appearance.htm > Style the jQuery DockingLayout: the jqxDockingLayout CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxDockingLayout. - jqx-docking-layout - applied to the jqxDockingLayout. - jqx-layout - applied to the jqxDockingLayout. - jqx-widget - applied to the jqxDockingLayout. - jqx-widget-content - applied to the jqxDockingLayout. - jqx-rc-all - applied to the jqxDockingLayout. - jqx-layout-group-root - applied to the root layout group. - jqx-layout-group-default - applied to layout groups. - jqx-layout-group-document - applied to document groups. - jqx-layout-group-tabbed - applied to tabbed groups. - jqx-layout-group-auto-hide - applied to auto hide groups. - jqx-layout-group-auto-hide-content-horizontal - applied to the content sections of horizontally-aligned auto hide groups. - jqx-layout-group-auto-hide-content-vertical - applied to the content sections of vertically-aligned auto hide groups. - jqx-docking-layout-group-floating - applied to float groups. - jqx-layout-pseudo-window - applied to pseudo-jqxWindows in tabbed and auto hide groups. - jqx-layout-pseudo-window-header - applied to pseudo-jqxWindow headers. - jqx-layout-pseudo-window-title - applied to pseudo-jqxWindow titles. - jqx-layout-pseudo-window-pin-icon - applied to pseudo-jqxWindow pin icons. - jqx-layout-pseudo-window-pinned-icon - applied to pseudo-jqxWindow unpin icons. - jqx-layout-pseudo-window-close-icon - applied to pseudo-jqxWindow close icons. - jqx-layout-pseudo-window-content - applied to pseudo-jqxWindow content sections. - jqx-layout-resize-feedback - applied to the horizontal and vertical resize feedbacks. - jqx-layout-resize-feedback-horizontal - applied to the horizontal resize feedback. - jqx-layout-resize-feedback-vertical - applied to the vertical resize feedback. - jqx-layout-resize-feedback-warning - applied to the resize feedbacks when a minimum width has been reached. - jqx-docking-layout-overlay - applied to the overlay with squares which appears when a float group is dragged (drag overlay). - jqx-docking-layout-overlay-square - applied to the squares in the drag overlay. - jqx-docking-layout-square-disabled - applied to squares in the drag overlay to indicate a drop operation is not allowed. - jqx-docking-layout-overlay-inner-square - applied to the inner, dialog-resembling, squares in the drag overlay. - jqx-docking-layout-overlay-inner-square-header - applied to the header of the drag overlay inner squares and the "mini windows" of edge squares. - jqx-docking-layout-overlay-inner-square-content - applied to the content of the drag overlay inner squares and the "mini windows" of edge squares. - jqx-docking-layout-overlay-highlight - applied to the highlighted part of the content of the drag overlay inner squares. - jqx-docking-layout-drop-overlay - applied to the overlay which appears when a float group is about to be docked. - jqx-docking-layout-overlay-square-edge - applied to the squares which appear at the left, right, top and bottom of the widget when a float group is dragged. - jqx-docking-layout-overlay-mini-window-edge-horizontal - applied to the inner, dialog-resembling, squares in the left and right edge squares. - jqx-docking-layout-overlay-mini-window-edge-vertical - applied to the inner, dialog-resembling, squares in the top and bottom edge squares. - jqx-docking-layout-overlay-inner-square-content-horizontal - applied to the content of the "mini windows" of the left and right edge squares. - jqx-docking-layout-overlay-inner-square-content-vertical - applied to the content of the "mini windows" of the top and bottom edge squares. - jqx-docking-layout-overlay-square-edge-arrow - applied to the arrows of the edge squares. When you create a custom style with colors and backgrounds for jqxDockingLayout, you need to do the following: - Add the above CSS classes related to jqxDockingLayout - After each CSS class, add your theme name. For example: jqx-docking-layout-energyblue - To apply your custom style to jqxDockingLayout, you need to set its 'theme' property (option) to point to your theme name string: ```html ``` - The sample below demonstrates how to set the 'energyblue' theme to jqxDockingLayout: ```html jQuery Docking Layout Styling Sample
List of tools
Help topics
Document 1 content
Document 2 content
List of errors
Solution structure
List of properties
Output
``` --- ### jQuery DockingLayout API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockinglayout/jquery-docking-layout-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdockinglayout.txt #### Properties - `contextMenu` (Type: Boolean, Default: false): (Requires jqxmenu.js.) - `height` (Type: Number/String, Default: null): Sets or gets the docking layout's height. - `layout` (Type: Array, Default: []): Sets or gets the layout. This property determines the position of the docking layout elements and their characteristics. The first member of the layout array should always be an item of type 'layoutGroup'. - `minGroupHeight` (Type: Number, Default: 100): Sets the default minimum height for groups which are vertically aligned within their parent group. - `minGroupWidth` (Type: Number, Default: 100): Sets the default minimum width for groups which are horizontally aligned within their parent group. - `resizable` (Type: Boolean, Default: true): Sets or gets whether panels can be dynamically resized. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `width` (Type: Number/String, Default: null): Sets or gets the docking layout's width. #### Events - `create` (Type: Event): This event is triggered when the widget is created. - `dock` (Type: Event): This event is triggered when a floatGroup has been docked. - `floatGroupClosed` (Type: Event): This event is triggered when a floatGroup has been closed. - `float` (Type: Event): This event is triggered when a group or panel has been floated. - `pin` (Type: Event): This event is triggered when a group has been pinned. - `resize` (Type: Event): This event is triggered when a group has been resized (when the group has been resized with the mouse or when an adjacent group has been pinned, unpinned or closed). - `unpin` (Type: Event): This event is triggered when a group has been unpinned. #### Methods - `addFloatGroup` (Type: Method): Adds a new floatGroup. - `destroy` (Type: Method): Destroys the widget. - `loadLayout` (Type: Method): Loads a previously saved layout. - `refresh` (Type: Method): Refreshes the widget. - `render` (Type: Method): Renders the widget. - `saveLayout` (Type: Method): Saves the current layout of the widget. The object returned by this method can be passed to the method **loadLayout**. --- ### jQuery DockPanel Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockpanel/jquery-dockpanel-getting-started.htm > jQuery DockPanel getting started: install jQWidgets, add jqxDockPanel to your app, see a complete example, then handle its events and call its methods. The jqxDockPanel widget represents a container for other widgets or elements. It arranges its inner elements depending on the value of the 'dock' attribute. The possible 'dock' attribute values are: 'left, right, top and bottom'. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `2` scripts, listed below - **Demos:** [jQuery DockPanel demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdockpanel/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockpanel/jquery-dockpanel-api.htm) Load the styles and the DockPanel's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#dockPanel').jqxDockPanel({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdockpanel/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxDockPanel widget requires the following files: ```html ``` The next step is to create a DIV element within the body of the html document and add the elements that will be inside the dock panel. ```html
First Div
Second Div
Third Div
Fourth Div
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxDockPanel’s constructor. ```javascript $("#jqxdockpanel").jqxDockPanel(‘render’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxDockPanel's constructor. ```javascript $("#jqxdockpanel").jqxDockPanel({ disabled: true }); ``` To get a property(option), you need to pass the property name to the jqxDockPanel's constructor. ```javascript const disabled = $("#jqxdockpanel").jqxDockPanel('disabled'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the dockpanel's layout is changed. The example code below demonstrates how to bind to the ‘layout’ event of jqxDockPanel. ```javascript $("#jqxdockpanel").on('layout', function () { }); ``` #### Basic Sample ```html jQuery DockPanel Sample.
First Div
Second Div
Third Div
Fourth Div
``` --- ### jQuery DockPanel API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdockpanel/jquery-dockpanel-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdockpanel.txt #### Properties - `disabled` (Type: Boolean, Default: false): Gets whether the dockpanel is disabled. - `height` (Type: Number/String, Default: null): Sets or gets the dockpanel's height. - `lastchildfill` (Type: Boolean, Default: true): When true, the last child gets the available width and height. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `width` (Type: Number/String, Default: null): Sets or gets the dockpanel's width. #### Events - `layout` (Type: Event): Occurs when the layout is performed. --- ### jQuery DragDrop Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdragdrop/jquery-dragdrop-getting-started.htm > jQuery DragDrop getting started: install jQWidgets, add jqxDragDrop to your app, see a complete example, then handle its events and call its methods. jqxDragDrop is a plugin which will make any DOM element draggable. It can be used in combination with many widgets like jqxTree, jqxGrid, jqxListBox and etc. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `10` scripts, listed below - **Demos:** [jQuery DragDrop demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdragdrop/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdragdrop/jquery-dragdrop-api.htm) jqxDragDrop in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdragdrop/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the DragDrop's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#dragDrop').jqxDragDrop({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdragdrop/index.htm) show every option with its source code; the guide below explains them. Every UI widget or plugin from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and CSS dependencies to your project. The jqxDragDrop plugin requires the following files: ```html ``` The next step is to select DOM element/elements which you want to drag. The last step is to initialize jqxDragDrop by adding the following script: ```javascript $("#element").jqxDragDrop(); ``` To set a property (option), you need to pass the property name and value(s) in the jqxDragDrop's constructor. ```javascript $("#element").jqxDragDrop({ disabled: true }); ``` To get a property(option), you need to pass the property name to the jqxDragDrop's constructor. ```javascript const disabled = $("#element").jqxDragDrop('disabled'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get when the user start dragging the element. The example code below demonstrates how to bind to the ‘dragStart’ event of jqxDragDrop. ```javascript $('#element').on('dragStart', function (event) { alert('Drag Started'); }); ``` #### Basic Draggable Sample ```html jQuery DragDrop Sample
Drag me
``` --- ### jQuery DragDrop Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdragdrop/jquery-dragdrop-styling-and-appearance.htm > Style the jQuery DragDrop: the jqxDragDrop CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of CSS files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second CSS file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxDragDrop. - jqxDragDrop Style - jqx-dragdrop - applied to draggable elements. - jqx-dragdrop-dragging - applied to draggable while dragging. - jqx-dragdrop-disabled - applied to draggable elements with disabled dragging. When you create a custom style with colors and backgrounds for jqxDragDrop, you need to do the following: - Add the above CSS classes related to jqxDragDrop - After each CSS class, add your theme name. For example: jqx-dragdrop-energyblue - To apply your custom style to jqxDragDrop, you need to set its 'theme' property (option) to point to your theme name string. --- ### jQuery DragDrop API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdragdrop/jquery-dragdrop-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdragdrop.txt #### Properties - `appendTo` (Type: String, Default: 'parent'): Sets or gets where will be appended the draggable's feedback. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the dragging is disabled. - `distance` (Type: Number, Default: 5): Sets or gets the distance required for the cursor to pass before the drag begins. - `data` (Type: Object, Default: null): This property can be used for setting some kind of information transferred with the draggable. - `dropAction` (Type: String, Default: 'default'): Sets or gets whether the draggable element will change its position ('default') or not ('none') when the element is dropped. - `dropTarget` (Type: String/Object, Default: null.): Sets or gets the drop target. The drop target is a DOM element(s) for which jqxDragDrop triggers events when the user drags or drops the draggable element over that element(s). - `dragZIndex` (Type: Number, Default: 99999): Sets or gets element's z-index when it's dragging. - `feedback` (Type: String, Default: 'clone'): Sets or gets the feedback. The feedback is the object which is actually dragged by the user. - `initFeedback` (Type: Function, Default: null): Callback which is executing when the feedback is created. - `opacity` (Type: Number, Default: 0.6): Sets or gets draggable object's opacity when it's dragging. - `onDragEnd` (Type: Function, Default: null): Callback which is executing when the drag ends. - `onDrag` (Type: Function, Default: null): Callback which is executing while dragging. - `onDragStart` (Type: Function, Default: null): Callback which is executing when drag start. - `onTargetDrop` (Type: Function, Default: null): Callback which is executing when drag ends over the drop target. - `onDropTargetEnter` (Type: Function, Default: null): Callback which is executing when the draggable enter any of it's drop targets. - `onDropTargetLeave` (Type: Function, Default: null): Callback which is executing when the draggable leave any of it's drop targets. - `restricter` (Type: Object/String, Default: 'document'): Sets or gets dragdrop's restrict area. - `revert` (Type: Boolean, Default: false): Sets or gets whether the draggable element will be reverted to it's original position after drop. - `revertDuration` (Type: Number, Default: 400): Sets or gets the duration for which the draggable object will be reverted. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `tolerance` (Type: String, Default: 'intersect'): Sets or gets whether the draggable item is over it's drop target when it's intersecting it or when it's fully inside it's target. #### Events - `dragStart` (Type: Event): This event is triggered when the item is dragged for first time. - `dragEnd` (Type: Event): This event is triggered when the item is dropped. - `dragging` (Type: Event): This event is triggered while the item is dragging. - `dropTargetEnter` (Type: Event): This event is triggered when the draggable item is over it's drop target for first time. - `dropTargetLeave` (Type: Event): This event is triggered when the draggable item leave it's drop target. --- ### jQuery Draw Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdraw/jquery-draw-getting-started.htm > jQuery Draw getting started: install jQWidgets, add jqxDraw to your app, see a complete example, then handle its events and call its methods. jqxDraw is a small jQuery-based plugin which allows you to draw shapes and texts using VML, SVG and HTML5. In order to use the jqxDraw plugin, you need to include the following JavaScript files in your project. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `3` scripts, listed below - **Demos:** [jQuery Draw demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdraw/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdraw/jquery-draw-api.htm) jqxDraw in the [Drawing Shapes](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdraw/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Draw's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#draw').jqxDraw({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdraw/index.htm) show every option with its source code; the guide below explains them. ```html ``` The next step is to select an element with jQuery and use the jqxDraw constructor to initialize the plugin. ```html ``` To set a property (option), you need to pass the property name and value(s) in the jqxDraw's constructor. ```javascript $('#jqxDraw').jqxDraw({renderEngine: 'HTML5'}); ``` To get a property(option), you need to pass the property name to the jqxTouch's constructor. ```javascript var renderEngine = $('#jqxDraw').jqxDraw('renderEngine'}); ``` To bind to an event, you need to do the following: ```javascript $('#container').jqxDraw(); var renderer = $('#container').jqxDraw('getInstance'); // create a circle // params: cx, cy, radius, params var circleElement = renderer.circle(250, 150, 50, {fill: 'lightblue'}}); renderer.on(circleElement, 'click', function () { // get the Y coordinate of the circle's center var circleY = parseInt(renderer.getAttr(circleElement, 'cy')); // move the circle 10 pixels down renderer.attr(circleElement, { cy: circleY + 10; }); }); ``` #### Drawing Shapes with jqxDraw ```html jqxDraw - Basic shapes drawing example
``` --- ### jQuery Draw API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdraw/jquery-draw-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdraw.txt #### Properties - `renderEngine` (Type: String, Default: ''): Determines the rendering engine used to display the chart. Possible values are 'SVG', 'VML' and 'HTML5'. #### Properties - `attr` (Arguments: element, attributes, Return Value: none): Sets attributes of an element - `circle` (Type: cx, cy, r, {optional attributes}, Description: element object): Creates a circle element - `clear` (Type: None, Description: None): Clears the content of the jqxDraw widget. - `getAttr` (Type: element, attribute name, Description: string): Gets element's attribute - `line` (Type: x1, y1, x2, y2, {optional attributes}, Description: element object): Creates a line element - `measureText` (Type: text, angle, {optional attributes}, Description: {width, height}): Estimates the size of a text element - `on` (Type: element, event, function, Description: none): Adds an event handler to an element - `off` (Type: element, event, function, Description: none): Removes an event handler from an element - `path` (Type: line command , {optional attributes}, Description: element object): Creates a path element - `pieslice` (Type: cx, cy, innerRadius, outerRadius, fromAngle, endAngle, centerOffset, {optional attributes}, Description: element object): Creates a pie slice element - `refresh` (Type: None, Description: None): Refreshes / re-draws the content of the jqxDraw widget. - `rect` (Type: x, y, width, height, {optional attributes}, Description: element object): Creates a rectangle element - `saveAsJPEG` (Type: fileName, exportServer, Description: boolean): Exports the content as JPEG image. The browser must support HTML5 Canvas and the device must be able to connect to the export server. If you don't setup your own export server the default server is jqwidgets.com. - `saveAsPNG` (Type: fileName, exportServer, Description: boolean): Exports the chart's content as PNG image. The browser must support HTML5 Canvas and the device must be able to connect to the export server. If you don't setup your own export server the default server is jqwidgets.com. - `text` (Type: text, x, y, width, height, angle, attributes, clip, halign, valign, rotateAround, Description: element object): Creates a text element --- ### jQuery DropDownList Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdropdownlist/jquery-dropdownlist-getting-started.htm > jQuery DropDownList getting started: install jQWidgets, add jqxDropDownList to your app, see a complete example, then handle its events and call its methods. jqxDropDownList represents a JavaScript component that contains a list of selectable items displayed in a drop-down. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `5` scripts, listed below - **Demos:** [jQuery DropDownList demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdropdownlist/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdropdownlist/jquery-dropdownlist-api.htm) jqxDropDownList in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdropdownlist/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the DropDownList's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#dropDownList').jqxDropDownList({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdropdownlist/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxDropDownList widget requires the following files: ```html ``` The next step is to create a div element within the body of the html document. ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```javascript const source = [ "Instant coffee", "Irish coffee", "Liqueur coffee"]; // Create a jqxDropDownList $("#jqxdropdownlist").jqxDropDownList({ source: source, width: '200px', height: '25px' }); ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxDropDownList’s constructor. ```javascript $("#jqxdropdownlist").jqxDropDownList(‘selectIndex’, 1); ``` To get the result of a function(method) call, you need to pass the method name in the jqxDropDownList’s constructor. ```javascript $("#jqxdropdownlist").jqxDropDownList(‘getSelectedIndex’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxDropDownList's constructor. ```javascript $("#jqxdropdownlist").jqxDropDownList({ selectedIndex: 2 }); ``` To get a property(option), you need to pass the property name to the jqxDropDownList's constructor. ```javascript const index = $("#jqxdropdownlist").jqxDropDownList('selectedIndex'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the selected item when the user clicks. The example code below demonstrates how to bind to the ‘select’ event of jqxDropDownList. ```javascript $('#jqxDropDownList').on('select', function (event) { const args = event.args; const item = $('#jqxDropDownList').jqxDropDownList('getItem', args.index); }); ``` #### Basic Sample ```html jQuery DropDownList Sample
``` --- ### jQuery DropDownList Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdropdownlist/jquery-dropdownlist-styling-and-appearance.htm > Style the jQuery DropDownList: the jqxDropDownList CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxDropDownList. - jqx-widget - applied to the dropdownlist. - jqx-dropdownlist-content - applied to the dropdownlist's content element which displays the selected item's text or html. - jqx-dropdownlist-content-disabled - applied to the dropdownlist's content element which displays the selected item's text or html and the widget is disabled. - jqx-dropdownlist-state-normal - applied to the dropdownlist in default state. - jqx-fill-state-normal - applied to the dropdownlist in default state. - jqx-dropdownlist-state-hover - applied to the dropdownlist in hovered state. - jqx-fill-state-hover - applied to the dropdownlist in hovered state. - jqx-dropdownlist-state-selected - applied to the dropdownlist in selected state. - jqx-fill-state-pressed - applied to the dropdownlist in selected state. - jqx-dropdownlist-state-disabled - applied to the dropdownlist in disabled state. - jqx-fill-state-focus - applied to the dropdownlist when it is focused. - jqx-fill-state-disabled - applied to the dropdownlist when it is disabled. *jqxDropDownList internally use the jqxListBox widget. For additional information about styling jqxListBox, please take a look at the jqxListBox's Styling and Appearance help topic. When you create a custom style with colors and backgrounds for jqxDropDownList, you need to do the following: - Add the above CSS classes related to jqxDropDownList - After each CSS class, add your theme name. For example: jqx-dropdownlist-summer - To apply your custom style to jqxDropDownList, you need to set its 'theme' property(option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Summer' theme to jqxDropDownList. ```html jQuery DropDownList CSS Styling Sample
``` --- ### jQuery DropDownList API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdropdownlist/jquery-dropdownlist-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxdropdownlist.txt #### Properties - `autoOpen` (Type: Boolean, Default: false): Sets or gets whether the DropDown is automatically opened when the mouse cursor is moved over the widget. - `autoItemsHeight` (Type: Boolean, Default: false): Sets or gets whether items will wrap when they reach the width of the dropDown. - `autoDropDownHeight` (Type: Boolean, Default: false): Sets or gets whether the height of the jqxDropDownList's ListBox displayed in the widget's DropDown is calculated as a sum of the items heights. - `animationType` (Type: String, Default: 'slide'): Sets or gets the type of the animation. - `checkboxes` (Type: Boolean, Default: false): Determines whether checkboxes will be displayed next to the list items. (The feature requires jqxcheckbox.js) - `closeDelay` (Type: Number, Default: 400): Sets or gets the delay of the 'close' animation. - `disabled` (Type: Boolean, Default: false): Enables/disables the jqxDropDownList. - `displayMember` (Type: String, Default: ""): Sets or gets the displayMember of the Items. The displayMember specifies the name of an object property to display. The name is contained in the collection specified by the 'source' property. - `dropDownHorizontalAlignment` (Type: String, Default: 'left'): Sets or gets the DropDown's alignment. - `dropDownVerticalAlignment` (Type: String, Default: 'bottom'): Sets or gets the DropDown's alignment. - `dropDownHeight` (Type: Number, Default: 200): Sets or gets the height of the jqxDropDownList's ListBox displayed in the widget's DropDown. - `dropDownWidth` (Type: Number, Default: 200): Sets or gets the width of the jqxDropDownList's ListBox displayed in the widget's DropDown. - `enableSelection` (Type: Boolean, Default: true): Enables/disables the selection. - `enableBrowserBoundsDetection` (Type: Boolean, Default: false): Sets or gets whether the dropdown detects the browser window's bounds and automatically adjusts the dropdown's position. - `enableHover` (Type: Boolean, Default: true): Enables/disables the hover state. - `filterable` (Type: Boolean, Default: false): Determines whether the Filtering is enabled. - `filterHeight` (Type: Number, Default: 27): Determines the Filter's height. - `filterDelay` (Type: Number, Default: 100): Determines the Filter's delay. After 100 milliseconds, the widget automatically filters its data based on the filter input's value. To perform filter only on "Enter" key press, set this property to 0. - `filterPlaceHolder` (Type: String, Default: "Looking for"): Determines the Filter input's place holder. - `height` (Type: Number/String, Default: null): Sets or gets the jqxDropDownList's height. - `incrementalSearch` (Type: Boolean, Default: true): Sets or gets the incrementalSearch property. An incremental search begins searching as soon as you type the first character of the search string. - `incrementalSearchDelay` (Type: Number, Default: 700): Sets or gets the incrementalSearchDelay property. The incrementalSearchDelay specifies the time-interval in milliseconds after which the previous search string is deleted. The timer starts when you stop typing. - `itemHeight` (Type: Number, Default: -1): Sets or gets the height of the jqxDropDownList Items. When the itemHeight == - 1, each item's height is equal to its desired height. - `openDelay` (Type: Number, Default: 350): Sets or gets the delay of the 'open' animation. - `placeHolder` (Type: String, Default: "Please Choose:"): Text displayed when the selection is empty. - `popupZIndex` (Type: Number, Default: 20000): Sets or gets the popup's z-index. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `renderer` (Type: Function, Default: null): Callback function which is called when an item is rendered. By using the renderer function, you can customize the look of the list items. - `selectionRenderer` (Type: Function, Default: null): Callback function which is called when the selected item is rendered in the jqxDropDownList's content area. By using the selectionRenderer function, you can customize the look of the selected item. - `searchMode` (Type: String, Default: startswith): Sets or gets the item incremental search mode. When the user types some text in a focused DropDownList, the jqxListBox widget tries to find the searched item using the entered text and the selected search mode. - `scrollBarSize` (Type: Number, Default: 17): Sets or gets the scrollbars size. - `source` (Type: Array, Default: null): Sets or gets the items source. - `selectedIndex` (Type: Number, Default: -1): Sets or gets the selected index. - `template` (Type: String, Default: 'default'): Determines the template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `valueMember` (Type: String, Default: ""): Sets or gets the valueMember of the Items. The valueMember specifies the name of an object property to set as a 'value' of the list items. The name is contained in the collection specified by the 'source' property. - `width` (Type: Number/String, Default: null): Sets or gets the jqxDropDownList's width. #### Events - `bindingComplete` (Type: Event): This event is triggered when the data binding operation is completed. - `close` (Type: Event): This event is triggered when the popup ListBox is closed. - `checkChange` (Type: Event): This event is triggered when an item is checked/unchecked. - `change` (Type: Event): This event is triggered when the user selects an item. - `open` (Type: Event): This event is triggered when the popup ListBox is opened. - `select` (Type: Event): This event is triggered when the user selects an item. - `unselect` (Type: Event): This event is triggered when the user unselects an item. #### Methods - `addItem` (Type: Method): Adds a new item to the jqxDropDownList. Returns 'true', if the new item is added or 'false' if the item is not added. - `clearSelection` (Type: Method): Clears all selected items. - `clear` (Type: Method): Clears all items. - `close` (Type: Method): Hides the popup listbox. - `checkIndex` (Type: Method): Checks a list item when the 'checkboxes' property value is true. The index is zero-based, i.e to check the first item, the 'checkIndex' method should be called with parameter 0. - `checkItem` (Type: Method): Checks an item. - `checkAll` (Type: Method): Checks all list items when the 'checkboxes' property value is true. - `clearFilter` (Type: Method): Clears the widget's filter when filtering is applied. - `destroy` (Type: Method): Destroys the widget. - `disableItem` (Type: Method): Disables an item. Item is an Object. - `disableAt` (Type: Method): Disables an item by index. Index is a number. - `enableItem` (Type: Method): Enables an item. Item is an Object. - `enableAt` (Type: Method): Enables a disabled item by index. Index is a number. - `ensureVisible` (Type: Method): Ensures that an item is visible. index is number. When necessary, the jqxDropDownList scrolls to the item to make it visible. - `focus` (Type: Method): Sets the focus to the widget. - `getItem` (Type: Method): Gets item by index. The returned value is an Object with the following fields: - `getItemByValue` (Type: Method): Gets an item by its value. The returned value is an Object with the following fields: - `getItems` (Type: Method): Gets all items. The returned value is an array of Items. - `getCheckedItems` (Type: Method): Gets the checked items. The returned value is an array of Items. - `getSelectedItem` (Type: Method): Gets the selected item. The returned value is an Object or null(if there is no selected item). - `getSelectedIndex` (Type: Method): Gets the index of the selected item. The returned value is the index of the selected item. If there's no selected item, -1 is returned. - `insertAt` (Type: Method): Inserts a new item to the jqxDropDownList. Returns 'true', if the new item is inserted or false if the insertion fails. The first parameter is Object or String - the new item. - `isOpened` (Type: Method): Returns true, if the popup is opened. Otherwise returns false. - `indeterminateIndex` (Type: Method): indeterminates a list item when the 'checkboxes' property value is true. The index is zero-based, i.e to indeterminate the first item, the 'indeterminateIndex' method should be called with parameter 0. - `indeterminateItem` (Type: Method): Indeterminates an item. - `loadFromSelect` (Type: Method): Loads list items from a 'select' tag. - `open` (Type: Method): Shows the popup listbox. - `removeItem` (Type: Method): Removes an item from the listbox. Parameter type: Object returned by the "getItem" method or String - the value of an item. Returns 'true', if the item is removed or 'false', if the item is not removed. - `removeAt` (Type: Method): Removes an item from the listbox. Parameter type: Number - the index of the item. The method returns 'true', if the item is removed or 'false', if the item is not removed. - `selectIndex` (Type: Method): Selects an item by index. The index is zero-based, i.e to select the first item, the 'selectIndex' method should be called with parameter 0. - `selectItem` (Type: Method): Selects an item. - `setContent` (Type: Method): Sets the content of the DropDownList. - `updateItem` (Type: Method): Updates an item. The first parameter is the new item. The second parameter could be an existing item or the value of an existing item. - `updateAt` (Type: Method): Updates an item. The first parameter is the new item. The second parameter is the index of the item to be updated. - `unselectIndex` (Type: Method): Unselects item by index. The index is zero-based, i.e to unselect the first item, the 'unselectIndex' method should be called with parameter 0. - `unselectItem` (Type: Method): Unselects an item. - `uncheckIndex` (Type: Method): Unchecks a list item when the 'checkboxes' property value is true. The index is zero-based, i.e to uncheck the first item, the 'uncheckIndex' method should be called with parameter 0. - `uncheckItem` (Type: Method): Unchecks an item. - `uncheckAll` (Type: Method): Unchecks all list items when the 'checkboxes' property value is true. - `val` (Type: Method): Sets or gets the selected value. --- ### jQuery Editor Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxeditor/jquery-editor-getting-started.htm > jQuery Editor getting started: install jQWidgets, add jqxEditor to your app, see a complete example, then handle its events and call its methods. jqxEditor represents a ready-for-use HTML text editor which can simplify web content creation or be a replacement of your HTML Text Areas. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `11` scripts, listed below - **Demos:** [jQuery Editor demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxeditor/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxeditor/jquery-editor-api.htm) jqxEditor in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxeditor/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Editor's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#editor').jqxEditor({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxeditor/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxEditor widget requires the following files: ```html ``` The next step is to create a TextArea or DIV element within the body of the html document. ```html ``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxEditor’s constructor. ```javascript $("#editor").jqxEditor('print'); ``` To get the jqxEditor's value, you need to do the following: ```javascript const value = $("#editor").val(); ``` To set a property(option), you need to pass the property name and value(s) in the jqxEditor's constructor. ```javascript $("#editor").jqxEditor({ lineBreak: 'div' }); ``` To get a property(option), you need to pass the property name to the jqxEditor's constructor. ```javascript const lineBeak = $("#editor").jqxEditor('lineBreak'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the Editor value is changed. ```javascript // bind to 'change' event. $('#editor').on('change', function (event) { }); ``` #### Basic Sample ```html jQuery Editor Widget. ``` --- ### jQuery Editor Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxeditor/jquery-editor-styling-and-appearance.htm > Style the jQuery Editor: the jqxEditor CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxEditor. - jqx-editor - applied to the editor. - jqx-editor-inline - applied to the editor when it is in inline mode. - jqx-editor-inline-focus - applied to the editor when it is focused and in inline mode. - jqx-widget - applied to the editor. - jqx-widget-content - applied to the editor's content area. - jqx-editor-content - applied to the editor's content area. - jqx-rc-all - applied to the editor. Adds rounded corners to the widget. - jqx-widget-header - applied to the editor and its toolbar. - jqx-fill-state-disabled - applied to the editor when it is disabled. - jqx-editor-window - applied to the editor's dialog windows. - jqx-editor-toolbar - applied to the editor's toolbar. - jqx-editor-toolbar-inline - applied to the editor's toolbar when the editor is in inline mode. - jqx-editor-toolbar-icon - applied to the tool icons. - jqx-editor-toolbar-item - applied to the tools. - jqx-editor-toolbar-group - applied to the tool groups. - jqx-editor-toolbar-button - applied to the tool buttons. - jqx-editor-color-bar - applied to the color bar of a color picker tool. - jqx-editor-color-picker - applied to the color picker tool. - jqx-editor-color-picker-selected-cell - applied to the selected cell of a color picker. When you create a custom style with colors and backgrounds for jqxEditor, you need to do the following: - Add the above CSS classes related to jqxEditor - After each CSS class, add your theme name. For example: jqx-editor-arctic - To apply your custom style to jqxEditor, you need to set its 'theme' property(option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Arctic' theme to jqxEditor. ```html HTML Editor. ``` --- ### jQuery Editor API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxeditor/jquery-editor-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxeditor.txt #### Properties - `createCommand` (Type: Function, Default: null): Sets or gets the jqxEditor's createCommand property. The property allows you to add new commands or override existing commands. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the jqxEditor is disabled. - `editable` (Type: Boolean, Default: true): Sets or gets the jqxEditor's editable property. The property determines whether the jqxEditor is read only. - `height` (Type: Number/String, Default: null): Sets or gets the jqxEditor's height. - `lineBreak` (Type: String, Default: "default"): Sets or gets the jqxEditor's line break. The property determines whether the jqxEditor creates `BR`, `P` or `DIV` tag when the `Enter` key is pressed or uses the web browser's default mode. - `localization` (Type: Object, Default: { "bold": "Bold", "italic": "Italic", "underline": "Underline", "format": "Format Block", "font": "Font Name", "size": "Font Size", "color": "Text Color", "background": "Fill Color", "left": "Align Left", "center": "Align Center", "right": "Align Right", "outdent": "Indent Less", "indent": "Indent More", "ul": "Insert unordered list", "ol": "Insert ordered list", "image": "Insert image", "link": "Insert link", "html": "View source", "clean": "Remove Formatting" }): Sets or gets the jqxEditor's localization. The property determines the localization of the jqxEditor. - `pasteMode` (Type: String, Default: "html"): Sets or gets the jqxEditor's paste mode. The property determines whether the clipboard data is pasted as HTML or Plain Text. Possible values: "html" and "text". - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `stylesheets` (Type: Array, Default: []): Sets or gets the jqxEditor's stylesheets. The property allows you to include stylesheets into the jqxEditor's IFrame. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `toolbarPosition` (Type: String, Default: "top"): Sets or gets the jqxEditor's toolbar position. The property determines the position of the jqxEditor's toolbar. - `tools` (Type: String, Default: "bold italic underline | format font size | color background | left center right | outdent indent | ul ol | image | link | clean | html"): Sets or gets the jqxEditor's tools. The property determines the visibility and layout of the jqxEditor's tools. - `width` (Type: Number/String, Default: null): Sets or gets the jqxEditor's width. #### Events - `change` (Type: Event): This is triggered when the jqxEditor's value is changed. #### Methods - `destroy` (Type: Method): Destroys the widget. - `focus` (Type: Method): Focuses the widget. - `print` (Type: Method): Prints the jqxEditor's value. - `setMode` (Type: Method): Sets the jqxEditor's mode. The method has one boolean parameter which determines whether the jqxEditor displays its value as formatted html or html code. - `val` (Type: Method): Sets or gets the value. --- ### jQuery Expander Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxexpander/jquery-expander-getting-started.htm > jQuery Expander getting started: install jQWidgets, add jqxExpander to your app, see a complete example, then handle its events and call its methods. jqxExpander represents a JavaScript component that has header and content sections(like tabs). Click headers to expand or collapse the content. Optionally you can change the default toggle mode to double-click or mouseover. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `2` scripts, listed below - **Demos:** [jQuery Expander demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxexpander/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxexpander/jquery-expander-api.htm) jqxExpander in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxexpander/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Expander's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#expander').jqxExpander({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxexpander/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxExpander widget requires the following files: ```html ``` The next step is to create a DIV element within the body of the html document and add a pair of DIV elements for the header and content. ```html
Header
Content
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters(if any) in the jqxExpander’s constructor. ```javascript $("#jqxExpander").jqxExpander(‘expand’); ``` To get the result of a function(method) call, you need to pass the method name in the jqxExpander’s constructor and parameters(if any). ```javascript var content = $("#jqxExpander").jqxExpander(‘getContent’); ``` To set a property(option), you need to pass the property name and value(s) in the jqxExpander's constructor. ```javascript $("#jqxExpander").jqxExpander({ disabled: true }); ``` To get a property(option), you need to pass the property name to the jqxExpander's constructor. ```javascript const disabled = $("#jqxExpander").jqxExpander('disabled'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get the selected item when the user clicks. The example code below demonstrates how to bind to the ‘collapsed’ event of jqxExpander. ```javascript // bind to collapsed event. $("#jqxexpander").on('collapsed', function (event) { alert("Collapsed"); }); ``` #### Basic Sample ```html jQuery Expander Sample
Header
Content
``` --- ### jQuery Expander Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxexpander/jquery-expander-styling-and-appearance.htm > Style the jQuery Expander: the jqxExpander CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxExpander. - jqx-widget - applied to the jqxExpander widget. - jqx-expander - applied to the jqxExpander. - jqx-expander-header - applied to the expander's header. - jqx-widget-header - applied to the header elements. - jqx-fill-state-normal - applied to the header element. - jqx-expander-content - applied to the content element. - jqx-widget-content - applied to the content element. - jqx-expander-arrow - applied to the header's expand/collapse button. - jqx-expander-arrow-top - applied to the expander's expand/collapse button and displays arrow icon. - jqx-expander-arrow-bottom - applied to the expander's expand/collapse button and displays arrow icon. - jqx-expander-header-hover - applied to a hovered header element. - jqx-fill-state-hover - applied to a hovered header element. - jqx-fill-state-pressed - applied to an expanded header element. - jqx-fill-state-focus - applied to focused Content or Header element. - jqx-fill-state-disabled - applied to the jqxExpander when it is disabled. When you create a custom style with colors and backgrounds for jqxExpander, you need to do the following: - Add the above CSS classes related to jqxExpander - After each CSS class, add your theme name. For example: jqx-expander-summer - To apply your custom style to jqxExpander, you need to set its 'theme' property(option) to point to your theme name string. ```html ``` - The sample below demonstrates how to set the 'Summer' theme to jqxExpander. ```html jQuery Expander CSS Styling Sample
Header
Content
``` --- ### jQuery Expander API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxexpander/jquery-expander-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxexpander.txt #### Properties - `animationType` (Type: String, Default: 'slide'): Sets or gets the animation type. - `arrowPosition` (Type: String, Default: 'left'): Sets or gets header's arrow position. - `collapseAnimationDuration` (Type: Number, Default: 400): Sets or gets the collapsing animation duration. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the expander is disabled. - `expanded` (Type: Boolean, Default: true): Sets or gets expander's state (collapsed or expanded). - `expandAnimationDuration` (Type: Number, Default: 400): Sets or gets the expanding animation duration. - `height` (Type: Number/String, Default: 'auto'): Sets or gets expander's height. Possible values - 'auto' or string like this 'Npx' where N is any Number or a numeric value in pixels. - `headerPosition` (Type: String, Default: 'top'): Sets or gets header's position. - `initContent` (Type: function, Default: null): Callback function called when the item's content needs to be initialized. Useful for initializing other widgets within the content of jqxExpander. - `rtl` (Type: Boolean, Default: false): Determines whether the right-to-left support is enabled. - `showArrow` (Type: Boolean, Default: true): Sets or gets whether header's arrow is going to be shown. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `toggleMode` (Type: String, Default: 'click'): Sets or gets user interaction used for expanding or collapsing the content. - `width` (Type: Number/String, Default: 'auto'): Sets or gets expander's width.Possible values - 'auto' or string like this 'Npx' where N is any Number or a numeric value in pixels. #### Events - `collapsing` (Type: Event): This event is triggered when the jqxExpander is going to be collapsed. - `collapsed` (Type: Event): This event is triggered when the jqxExpander is collapsed. - `expanding` (Type: Event): This event is triggered when the jqxExpander is going to be expanded. - `expanded` (Type: Event): This event is triggered when the jqxExpander is expanded. #### Methods - `collapse` (Type: Method): Method which is collapsing the expander. - `disable` (Type: Method): This method is disabling the expander. - `destroy` (Type: Method): This method destroys the expander. - `enable` (Type: Method): This method is enabling the expander. - `expand` (Type: Method): Method used for expanding the expander's content. - `focus` (Type: Method): This method focuses on the expander. When the widget is focused, keyboard navigation can be used. Here is a list of the keys, supported by jqxExpander and their function: - `getContent` (Type: Method): Getting expander's content. Returns a string with the content's HTML. - `getHeaderContent` (Type: Method): Getting expander's header content. Returns a string with the header's HTML. - `invalidate` (Type: Method): This method refreshes the expander. - `refresh` (Type: Method): This method refreshes the expander. - `render` (Type: Method): This method renders the expander. - `setHeaderContent` (Type: Method): This method is setting specific content to the expander's header. - `setContent` (Type: Method): This method is setting specific content to the expander. --- ### jQuery FileUpload Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxfileupload/jquery-file-upload-getting-started.htm > jQuery FileUpload getting started: install jQWidgets, add jqxFileUpload to your app, see a complete example, then handle its events and call its methods. jqxFileUpload is a widget which can be used to select files and upload them to a server. The file upload widget supports automatic upload and multiple files upload. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `3` scripts, listed below - **Demos:** [jQuery FileUpload demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxfileupload/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxfileupload/jquery-file-upload-api.htm) jqxFileUpload in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxfileupload/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the FileUpload's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#fileUpload').jqxFileUpload({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxfileupload/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxFileUpload widget requires the following files: ```html ``` The next step is to create a div element within the body of the html document: ```html
``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters (if any) in the jqxFileUpload's constructor: ```javascript $('#jqxFileUpload').jqxFileUpload('uploadAll'); ``` To set a property (option), you need to pass the property name and value(s) in the jqxFileUpload's constructor: ```javascript $('#jqxFileUpload').jqxFileUpload({ height: 200 }); ``` To get a property (option), you need to pass the property name to the jqxFileUpload's constructor: ```javascript const height = $('#jqxFileUpload').jqxFileUpload('height'); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when a file has been selected for upload: ```javascript // bind to 'select' event. $('#jqxFileUpload').on('select', function (event) { }); ``` #### Basic Sample ```html jQuery File Upload Sample
``` --- ### jQuery FileUpload Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxfileupload/jquery-file-upload-styling-and-appearance.htm > Style the jQuery FileUpload: the jqxFileUpload CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxFileUpload. - jqx-file-upload - applied to the file upload. - jqx-widget - applied to the file upload. - jqx-widget-content - applied to the file upload. - jqx-rc-all - applied to the file upload. Adds rounded corners to the widget. - jqx-fill-state-disabled - applied to the file upload when it is disabled. - jqx-file-upload-button-browse - applied to the "Browse" button. - jqx-file-upload-button-upload - applied to the "Upload All" button. - jqx-file-upload-button-cancel - applied to the "Cancel All" button. - jqx-file-upload-file-row - applied to the "row" containing the selected file's name and the "Upload File" and "Cancel" buttons. - jqx-file-upload-file-name - applied to the file name container. - jqx-file-upload-file-upload - applied to the "Upload File" button. - jqx-icon-arrow-up - applied to the icon of the "Upload File" button. - jqx-file-upload-file-cancel - applied to the "Cancel" button. - jqx-icon-close - applied to the icon of the "Cancel" button. - jqx-file-upload-loading-element - applied to each file row's loading element (animated image). When you create a custom style with colors and backgrounds for jqxFileUpload, you need to do the following: - Add the above CSS classes related to jqxFileUpload. - After each CSS class, add your theme name. For example: jqx-file-upload-summer - To apply your custom style to jqxFileUpload, you need to set its 'theme' property (option) to point to your theme name string. You can also apply templates to the buttons "Browse", "Upload All" and "Cancel All" by setting the properties 'browseTemplate', 'uploadTemplate' and 'cancelTemplate' respectively. The available templates are 'primary', 'info', 'success', 'warning', 'danger', 'inverse', 'link' and 'default' (no template). ```html ``` - The sample below demonstrates how to set the 'summer' theme to jqxFileUpload and the templates 'success', 'primary' and 'warning' to the "Browse", "Upload All" and "Cancel All" buttons respectively: ```html jQuery File Upload Styling Sample
``` --- ### jQuery FileUpload API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxfileupload/jquery-file-upload-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxfileupload.txt #### Properties - `autoUpload` (Type: Boolean, Default: false): Sets or gets whether files will be automatically uploaded when selected. - `accept` (Type: String, Default: null): Sets or gets the file types that can be submitted to the server through jqxFileUpload. - `browseTemplate` (Type: String, Default: ''): Sets or gets the template applied to the 'Browse' button. - `cancelTemplate` (Type: String, Default: ''): Sets or gets the template applied to the 'Cancel All' button. - `disabled` (Type: Boolean, Default: false): Enables or disables the jqxFileUpload. - `fileInputName` (Type: String, Default: ''): Sets or gets the `name` attribute of the hidden file input which is submitted to the URL specified by the `uploadUrl` property. - `height` (Type: Number/String, Default: 'auto'): Sets or gets the jqxFileUpload's height. - `localization` (Type: Object, Default: null): Sets the various text values used in the widget. Useful for localization. - `multipleFilesUpload` (Type: Boolean, Default: true): Sets or gets whether multiple files selection and upload are allowed. - `renderFiles` (Type: function, Default: null): A callback function used for rendering the file selection rows. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `uploadUrl` (Type: String, Default: ''): Sets or gets the upload URL. This property corresponds to the upload form's `action` attribute. For example, the uploadUrl property can point to a PHP file, which to handle the upload operation server-side. - `uploadTemplate` (Type: String, Default: ''): Sets or gets the template applied to the 'Upload All' button. - `width` (Type: Number/String, Default: null): Sets or gets the jqxFileUpload's width. #### Events - `remove` (Type: Event): This event is triggered when a file row has been removed. - `select` (Type: Event): This event is triggered when a file has been selected. - `uploadStart` (Type: Event): This event is triggered when a file upload operation has started. - `uploadEnd` (Type: Event): This event is triggered when a file upload operation has ended. #### Methods - `browse` (Type: Method): Browses for a file. - `cancelFile` (Type: Method): Cancels a selected file. - `cancelAll` (Type: Method): Cancels all selected files. - `destroy` (Type: Method): Destroys the jqxFileUpload. - `render` (Type: Method): Renders the widget. - `refresh` (Type: Method): Refreshes the widget. - `uploadFile` (Type: Method): Uploads a selected file. - `uploadAll` (Type: Method): Uploads all selected files. --- ### jQuery Form Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxform/jquery-form-getting-started.htm > jQuery Form getting started: install jQWidgets, add jqxForm to your app, see a complete example, then handle its events and call its methods. jqxForm is a light and easy to use component which allows you to setup a Form by using JSON configuration. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `8` scripts, listed below - **Demos:** [jQuery Form demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxform/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxform/jquery-form-api.htm) jqxForm in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxform/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Form's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#form').jqxForm({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxform/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxForm requires adding `jqxform.js` and all the widget files which you will use in your form. This is a sample Form configuration: ```javascript var template = [ { bind: 'firstName', type: 'text', label: 'First name', required: true, labelWidth: '80px', width: '250px', info: 'Enter first name', infoPosition: 'right' }, { bind: 'lastName', type: 'text', label: 'Last name', required: true, labelWidth: '80px', width: '250px', info: 'Enter last name' }, { bind: 'company', type: 'text', label: 'Company', required: false, labelWidth: '80px', width: '250px' }, { bind: 'address', type: 'text', label: 'Address', required: true, labelWidth: '80px', width: '250px' }, { bind: 'city', type: 'text', label: 'City', required: true, labelWidth: '80px', width: '250px' }, { bind: 'state', type: 'option', label: 'State', required: true, labelWidth: '80px', width: '250px', component: 'jqxDropDownList', options: [ { value: 'California' }, { value: 'New York' }, { value: 'Oregon' }, { value: 'Illinois' }, { value: 'Texas' }] }, { bind: 'zip', type: 'text', label: 'Zip code', required: true, labelWidth: '80px', width: '250px' }, { type: 'blank', rowHeight: '10px' }, { columns: [ { type: 'button', text: 'Sign up', width: '90px', height: '30px', rowHeight: '40px', columnWidth: '50%', align: 'right' }, { type: 'button', text: 'Cancel', width: '90px', height: '30px', rowHeight: '40px', columnWidth: '50%' }] }]; var sampleValue = { firstName: 'John', lastName: 'Scott', address: '1st Ave SW', company: 'N/A', city: 'San Antonio', state: 'Texas', zip: '78209' }; $('#sampleForm').jqxForm({ template: template, value: sampleValue, padding: { left: 10, top: 10, right: 10, bottom: 10 } }); ``` To call a function(method), you need to pass the method name and parameters (if any) in the jqxForm's constructor: ```javascript $("#jqxForm").jqxForm("submit"); ``` To set a property (option), you need to pass the property name and value(s) in the jqxForm's constructor: ```javascript $("#jqxForm").jqxForm({ borderColor: "#fafefd" }); ``` To get a property (option), you need to pass the property name to the jqxForm's constructor: ```javascript const borderColor = $("#jqxForm").jqxForm("borderColor"); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the input value (number) is changed: ```javascript // bind to 'jqxForm' event. $('#jqxForm').on('formDataChange', function (event) { }); ``` #### Basic Sample ```html jQuery Form Widget Component

Description

This example shows you how to build an interactive HTML form using JSON syntax. Each object in the JSON array describes a tool in the form. You can use textbox, password, dropdown, checkbox and other tools. You can also specify labels, set flags whether the field is optional, information tooltips and more. The form also allows you to define positioning of the label relative to the input field, separate widths of the label and the input field, alignment, row height, and more. For more information check the other examples and the API reference.
``` --- ### jQuery Form API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxform/jquery-form-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxform.txt #### Properties - `padding` (Type: undefined, Default: {left: 5, top: 5, right: 5, bottom: 5}): Gets or sets the jqxForm's padding. - `backgroundColor` (Type: string, Default: #F5F5F5): Gets or sets the jqxForm's backgroundColor. - `borderColor` (Type: string, Default: #E5E5E5): Gets or sets the jqxForm's borderColor. - `theme` (Type: string, Default: ''): Sets the widget's theme. - `value` (Type: object, Default: {}): Gets or sets the jqxForm's value. - `template` (Type: undefined): Gets or sets the jqxForm's template. Each object in the template, represents a Form row. Each row can have one field with label or multiple fields(if the current object's columns property is defined). - `enableSmartPaste` (Type: boolean): Sets the enableSmartPaste property. It handles form paste through AI. - `aiKey` (Type: string): Sets the ai key to the Grid. - `aiUrl` (Type: string): Sets the ai url to the Grid. #### Events - `formDataChange` (Type: Event): Binds to the 'formDataChange' event. - `buttonClick` (Type: Event): Binds to the 'buttonClick' event. #### Methods - `getInstance` (Type: Method): Calls `getInstance`. - `refresh` (Type: Method): | **Parameters** | - `destroy` (Type: Method): | **Parameters** | - `hideComponent` (Type: Method): | **Parameters** | - `showComponent` (Type: Method): | **Parameters** | - `val` (Type: Method): Sets or gets the value of the object to bind to the form. - `submit` (Type: Method): Submits the form. - `getComponentByName` (Type: Method): Gets a form input element by name. --- ### jQuery FormattedInput Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxformattedinput/jquery-formatted-input-getting-started.htm > jQuery FormattedInput getting started: install jQWidgets, add jqxFormattedInput to your app, see a complete example, then handle its events and call its… jqxFormattedInput represents an input widget for entering numbers in the binary, octal, decimal or hexadecimal numeral systems. The displayed number can be incremented or decremented through the widget's spin buttons (optional) and the numeral system can be changed programmatically or through a pop-up menu (optional). #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `2` scripts, listed below - **Demos:** [jQuery FormattedInput demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxformattedinput/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxformattedinput/jquery-formatted-input-api.htm) jqxFormattedInput in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxformattedinput/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the FormattedInput's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#formattedInput').jqxFormattedInput({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxformattedinput/index.htm) show every option with its source code; the guide below explains them. Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxFormattedInput widget requires the following files: ```html ``` The next step is to create the following structure in the body of the HTML document: ```html
``` The first child div is for the spin buttons and the second one - for the pop-up menu button. If you do not need the spin buttons and pop-up, you can initialize the widget from an input element: ```html ``` The last step is to initialize the widget by adding the following script to the html document: ```html ``` To call a function(method), you need to pass the method name and parameters (if any) in the jqxFormattedInput's constructor: ```javascript $("#jqxFormattedInput").jqxFormattedInput("open"); ``` To get the formatted input's value (the currently displayed number), you need to do the following: ```javascript const value = $("#jqxFormattedInput").val(); ``` To set a property (option), you need to pass the property name and value(s) in the jqxFormattedInput's constructor: ```javascript $("#jqxFormattedInput").jqxFormattedInput({ radix: "hexadecimal" }); ``` To get a property (option), you need to pass the property name to the jqxFormattedInput's constructor: ```javascript const min = $("#jqxFormattedInput").jqxFormattedInput("min"); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to know when the input value (number) is changed: ```javascript // bind to 'change' event. $('#jqxFormattedInput').on('change', function (event) { }); ``` #### Basic Sample ```html jQuery Formatted Input Sample
``` --- ### jQuery FormattedInput Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxformattedinput/jquery-formatted-input-styling-and-appearance.htm > Style the jQuery FormattedInput: the jqxFormattedInput CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxFormattedInput. - jqx-formatted-input - applied to the formatted input. - jqx-input - applied to the formatted input. - jqx-widget - applied to the formatted input and its pop-up. - jqx-widget-content - applied to the formatted input and its pop-up. - jqx-rc-all - applied to the formatted input (if the spin buttons and pop-up are disabled) or to the pop-up items. Adds rounded corners to the widget. - jqx-input-disabled - applied to the formatted input when it is disabled. - jqx-fill-state-disabled - applied to the formatted input when it is disabled. - jqx-formatted-input-spin-buttons-container - applied to the spin buttons container div. - jqx-formatted-input-spin-button - applied to the spin buttons. - jqx-formatted-input-addon - applied to the pop-up menu button div. - jqx-fill-state-normal - applied to the spin buttons container, spin buttons and pop-up menu button. - jqx-popup - applied to the formatted input's pop-up. - jqx-input-popup - applied to the formatted input's pop-up. - jqx-menu - applied to the formatted input's popup. - jqx-menu-vertical - applied to the formatted input's pop-up. - jqx-menu-dropdown - applied to the formatted input's pop-up. - jqx-menu-item - applied to the formatted input's pop-up items. - jqx-item - applied to the formatted input's pop-up items. - jqx-formatted-input-item - applied to the formatted input's pop-up items. - jqx-fill-state-pressed - applied to the selected item in the formatted input's pop-up. When you create a custom style with colors and backgrounds for jqxFormattedInput, you need to do the following: - Add the above CSS classes related to jqxFormattedInput - After each CSS class, add your theme name. For example: jqx-formatted-input-summer - To apply your custom style to jqxFormattedInput, you need to set its 'theme' property (option) to point to your theme name string: ```html ``` - The sample below demonstrates how to set the 'summer' theme to jqxFormattedInput: ```html jQuery Formatted Input Styling Sample
``` --- ### jQuery FormattedInput API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxformattedinput/jquery-formatted-input-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxformattedinput.txt #### Properties - `disabled` (Type: Boolean, Default: false): Enables or disables the jqxFormattedInput. - `decimalNotation` (Type: String, Default: "default"): Sets or gets the notation in which to display decimal numbers. - `dropDown` (Type: Boolean, Default: false): Sets or gets whether the jqxFormattedInput's dropdown (pop-up) will be enabled. The dropdown allows the user to choose the radix (numeral system) of the displayed number. - `dropDownWidth` (Type: Number/String, Default: null): Sets or gets the width of the jqxFormattedInput's dropdown (pop-up). - `height` (Type: Number/String, Default: null): Sets or gets the jqxFormattedInput's height. - `min` (Type: String, Default: '-9223372036854775808'): Sets or gets the minimum value of the widget. The value of min should be in the same numeral system as `value`. The min property can be set to no less than '-9223372036854775808' (-2⁶³) in decimal. - `max` (Type: String, Default: '9223372036854775807'): Sets or gets the maximum value of the widget. The value of max should be in the same numeral system as `value`. The max property can be set to no more than '9223372036854775807' (2⁶³ - 1) in decimal. - `placeHolder` (Type: String, Default: ''): Sets or gets the jqxFormattedInput's placeholder. - `popupZIndex` (Type: Number, Default: 20000): Sets or gets the pop-up's z-index. - `roundedCorners` (Type: boolean, Default: true): Enables or disables the rounded corners functionality. This property setting has effect in browsers which support CSS border-radius. - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `radix` (Type: Number/String, Default: 10): Sets or gets the radix of the jqxFormattedInput. The radix specifies the numeral system in which to display the widget's value. - `spinButtons` (Type: Boolean, Default: true): Shows or hides the spin buttons. - `spinButtonsStep` (Type: Number, Default: 1): Sets or gets the increase/decrease step. The value of `spinButtonsStep` is a decimal number. - `template` (Type: String, Default: 'default'): Determines the template as an alternative of the default styles. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `upperCase` (Type: boolean, Default: false): Sets or gets whether to use upper case when the `radix` property is set to 16 or 'hexadecimal'. - `value` (Type: String, Default: '0'): Sets or gets the value of the jqxFormattedInput widget. The value is in the numeral system specified by the `radix` property. - `width` (Type: Number/String, Default: null): Sets or gets the jqxFormattedInput's width. #### Events - `change` (Type: Event): This event is triggered when the value is changed. - `close` (Type: Event): This event is triggered when the pop-up is closed. - `open` (Type: Event): This event is triggered when the pop-up is opened. - `radixChange` (Type: Event): This event is triggered when the radix is changed. #### Methods - `close` (Type: Method): Closes the jqxFormattedInput pop-up. - `destroy` (Type: Method): Destroys the widget. - `focus` (Type: Method): Focuses the widget. - `open` (Type: Method): Opens the jqxFormattedInput pop-up. - `render` (Type: Method): Renders the widget. - `refresh` (Type: Method): Refreshes the widget. - `selectAll` (Type: Method): Selects the text in the input field. - `selectFirst` (Type: Method): Positions the caret in the beginning of the number in the input. - `selectLast` (Type: Method): Positions the caret at the end of the number in the input. - `val` (Type: Method): Sets or gets the value. --- ### jQuery Gauge Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgauge/jquery-gauge-getting-started.htm > jQuery Gauge getting started: install jQWidgets, add jqxGauge to your app, see a complete example, then handle its events and call its methods. jqxGauge displays an indicator within a range of values. Gauges can be used in a table or matrix to show the relative value of a field in a range of values in the data region, for example, as a KPI. It supports SVG and VML rendering. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `3` scripts, listed below - **Demos:** [jQuery Gauge demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgauge/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgauge/jquery-gauge-api.htm) jqxGauge in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgauge/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Gauge's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#gauge').jqxGauge({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgauge/index.htm) show every option with its source code; the guide below explains them. #### Getting Started Include all required JavaScript & CSS files: jqxGauge does not need jQuery: jqxcore.js has the small DOM layer it uses, and you can still add jQuery if your page uses it. Include the jQWidgets core framework file - jqxcore.js, the main jqxChart plug-in file - jqxchart.js file, the jqxGauge plugin file jqxgauge.js and the base jQWidgets stylesheet - jqx.base.css: ```html ``` Create a DIV element inside the body of your page. You need to define an element which will serve as a container for the gauge. DIV elements are convenient because you can easily position them. Give the DIV element an ID like 'gaugeContainer' or something that you like. ```html
``` Insert the jQuery document ready code inside the head section of your page: ```javascript $(document).ready(function() { // jqxGauge initialization code goes here. } ``` Prepare the gauge display settings and initialize the gauge. ```javascript $('#gaugeContainer').jqxGauge({ ranges: [{ startValue: 0, endValue: 55, style: { fill: '#C9C9C9', stroke: '#C9C9C9' }, endWidth: 5, startWidth: 1 }, { startValue: 55, endValue: 110, style: { fill: '#FCF06A', stroke: '#FCF06A' }, endWidth: 10, startWidth: 5 }, { startValue: 110, endValue: 165, style: { fill: '#FCA76A', stroke: '#FCA76A' }, endWidth: 15, startWidth: 10 }, { startValue: 165, endValue: 220, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 20, startWidth: 15}], ticksMinor: { interval: 5, size: '5%' }, ticksMajor: { interval: 10, size: '9%' }, value: 0, colorScheme: 'scheme03', animationDuration: 1200 }); ``` The code above specifies the gauge's ranges, value and color scheme, animationDuration, ticksMajor and ticksMinor size and interval. At last we will set jqxGauge's value: ```javascript $('#gaugeContainer').jqxGauge('value', 140); ``` If you want to get gauge's value use the following code: ```javascript const value = $('#gaugeContainer').jqxGauge('value'); ``` The complete source code for this example is here: ```html jqxGauge Basic Demo


Get value
Set value
``` ##### Linear Gauge The Linear Gauge is another type of Gauge widget which can be displayed either horizontally or vertically. In order to add the jqxLinearGauge to your web page, follow the instructions below. Create a DIV element inside the body of your page. You need to define an element which will serve as a container for the gauge. DIV elements are convenient because you can easily position them. Give the DIV element an ID like 'gaugeContainer' or something that you like. ```html
``` Insert the jQuery document ready code inside the head section of your page: ```javascript $(document).ready(function() { // jqxLinearGauge initialization code goes here. } ``` Prepare the gauge display settings and initialize it. The code below specifies the gauge's options: ```javascript $('#gaugeContainer').jqxLinearGauge({ max: 70, min: 0, pointer: { size: '5%' }, colorScheme: 'scheme02', ticksMajor: { size: '10%', interval: 10 }, ticksMinor: { size: '5%', interval: 2.5, style: { 'stroke-width': 1, stroke: '#aaaaaa'} }, ranges: [ { startValue: 20, endValue: 45, style: { fill: '#FFA200', stroke: '#FFA200'} }, { startValue: 45, endValue: 70, style: { fill: '#FF4800', stroke: '#FF4800'}}], value: 0 }); ``` In the last step we will set jqxLinearGauge's value: ```javascript $('#gaugeContainer').jqxLinearGauge('value', 140); ``` If you want to get gauge's value use the following code: ```javascript const value = $('#gaugeContainer').jqxLinearGauge('value'); ``` The complete source code for this example is here: ```html jqxLinearGauge - Basic Demo


Get value
Set value
``` --- ### jqxGauge Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgauge/jquery-gauge-styling-and-appearance.htm > Style the jQuery Gauge: the jqxGauge CSS classes, the theme stylesheets it uses and how to change its appearance. To set the jqxGauge's size, you need to use the 'width', 'height' and 'radius' properties. These properties accept percentage, number or pixel values. ```javascript $('#gauge').jqxGauge({ width: '20%', height: '30%', radius: '50%' }); ``` The 'colorScheme' property allows you to change the jqxGauge's appearance. The possible values are from "scheme01", "scheme02" to "scheme11". #### Ticks and labels To put the jqxGauge's labels at the inner side of the tick marks, you need to set the 'position' property of the labels object. ```javascript $('#gauge').jqxGauge({ labels: { position: 'inside' }}); ``` ```javascript $('#gauge').jqxGauge({ labels: { position: 'outside' }}); ``` To change the position of the start and end scales, use the startAngle and endAngle properties. The default values are 30 and 270. If the labels 'position' property is set to 'none', you can manually position the labels by setting a value to the 'distance' property. First set labels position property to 'none': ```javascript $('#gauge').jqxGauge({ labels: { position: 'none' }}); ``` The code example below sets the labels distance to be 5px from the gauge's bounds use the following code: ```javascript $('#gauge').jqxGauge({ labels: { distance: '5px' }}); ``` The ticksDistance property specifies the distance of the tick marks from the gauge's bounds. ```javascript $('#gauge').jqxGauge({ ticksDistance: '15px' }); ``` The labels CSS style is defined in the.jqx-gauge-label class which is part of the jqx.base.css. #### Ranges and Caption In order to display ranges in the jqxGauge, you need to set the 'ranges' property to an Array of ranges. Each range has startValue, endValue and specific style. ```javascript const ranges = [{ startValue: 0, endValue: 55, style: { fill: '#C9C9C9', stroke: '#C9C9C9' }, endWidth: 5, startWidth: 1, startDistance: 10, endDistance: 10 }, { startValue: 55, endValue: 110, style: { fill: '#FCF06A', stroke: '#FCF06A' }, endWidth: 10, startWidth: 5, startDistance: 10, endDistance: 10 }, { startValue: 110, endValue: 165, style: { fill: '#FCA76A', stroke: '#FCA76A' }, endWidth: 15, startWidth: 10, startDistance: 10, endDistance: 10 }, { startValue: 165, endValue: 220, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 20, startWidth: 15, startDistance: 10, endDistance: 10 }]; ``` The 'startWidth' and 'endWidth' properties of the ranges specify its size when the range begins and ends. To hide the ranges, set the showRanges property to false. ```javascript $('#gauge').jqxGauge('showRanges', false); ``` To display a caption in the jqxGauge, you need to set the 'caption' property. ```javascript $('#gauge').jqxGauge({ caption: { value: 'jQWidgets', position: 'bottom', offset: [0, 10], visible: true }}); ``` You can set value (text of the caption), position ('top', 'bottom', 'left' or 'right'), offset from the base position (array, the first element is the left offset the second one is the top offset) and the caption's visibility. The '.jqx-gauge-caption' CSS class is applied to the jqxGauge's caption. #### Cap and pointer The cap is the small circle displayed over the base of the pointer. ```javascript $('#gauge').jqxGauge({ cap: { size: '5%', style: { fill: '#ff0000', stroke: '#00ff00' } , visible: true }}); ``` You can set its size, style and visibility. ```javascript $('#gauge').jqxGauge({ pointer: { pointerType: 'default', style: { fill: '#ff0000', stroke: '#ff0000' }, length: '80%', width: '3%', visible: true }}); ``` #### jqxGauge's body, border and animation To change the jqxGauge's border, you need to set its 'border' property. The 'border' property is an object with several members - 'style', 'visible', 'showGradient' and 'size'. The code example below defines a border with size equal to 11% of the Gauge's size. The stroke color is: "#898989". ```javascript $('#gauge').jqxGauge({ border: { showGradient: true, size: '11%', style: { stroke: '#898989'}, visible: true }}); ``` When the border's 'showGradient' property is true, the background will be with gradient. If you want to use solid color for the border set the 'showGradient' to false. To change the background color or the stroke of your jqxGauge, use its 'style' property. ```javascript $('#gauge').jqxGauge({ style: { fill: '#cccccc', stroke: '#cccccc' }}); ``` The duration of the value changing animation is specified by the 'animationDuration' property. The 'easing' property specifies the easing of the value changing animation. Possible values are: 'linear', 'easeOutBack', 'easeInQuad', 'easeInOutCirc', 'easeInOutSine'. #### Working with jqxLinearGauge To create a Linear Gauge with size set in percentages, use can use the following: ```javascript $('#gauge').jqxLinearGauge({ width: '20%', height: '30%' }); ``` To change jqxLinearGauge's color scheme, use the 'colorScheme' property which accepts values from "scheme01", "scheme02" to "scheme11" ##### Ticks and labels To customize the ticks displayed in the Linear Gauge, you can use the 'ticksMajor' and 'ticksMinor' properties. ```javascript const ticksMajor = { size: '10%', interval: 5, style: { stroke: '#A1A1A1', 'stroke-width': 1 }, visible: true }; ``` In the code above, we set the tick's size, frequency, style and visibility. Tick's size can be set in percentage or pixels. If you want to change ticks appearance, you can use the 'style' property and set its 'stroke' and ''stroke-width' members. For example: ```javascript $('#gauge').jqxLinearGauge({ ticksMajor: { style: { stroke: '#000000', 'stroke-width': 2 } } }); ``` Ticks position is specified by the 'ticksPosition' property. The possible values are: 'far', 'near', 'both'. For example, If you set the 'ticksPosition' to 'far', ticks will be displayed on the right side of the value indicator. ```javascript $('#gauge').jqxLinearGauge({ ticksPosition: 'near' }); ``` To manually specify the ticks offset, use the 'ticksOffset' property. It is number and it sets the offset from the center of the gauge. Customization of the labels could be achieved using the labels property. Here is it's default value: ```javascript var labels = { position: 'both', interval: 20, offset: 0, visible: true, formatValue: function (value, position) {return value;} }; ``` The position property accepts the following values: 'far', 'near', 'both'. If it's 'near' labels will be visible in the left side of the scale. If it's value is 'far' labels will be visible in the right side of the scale. If the position property is with value 'both' labels will be visible in both sides of the scale. Similar to this property is ticksPosition used for the ticks. Let's consider the formatValue property. The formatValue is a callback function used for formatting the value of a single label. This function accepts two arguments - value and position. Value is the current label value. Position could be 'both', 'far' or 'near' depending on the value of the position property and the current iteration in the labels rendering. ##### Use jqxLinearGauge ranges A single range is a colored area with specific size. To set jqxLinearGauge's ranges you can use the 'ranges' property. Here is a sample value for the ranges property: ```javascript const ranges = [{ startValue: 20, endValue: 45, style: { fill: '#FFA200', stroke: '#FFA200' } }, { startValue: 45, endValue: 70, style: { fill: '#FF4800', stroke: '#FF4800' } }]; ``` The style of a single range can be change by changing the value of it's style property. You can set jqxLinearGauge's ranges by the following code: ```javascript $('#gauge').jqxLinearGauge({ ranges: [{ startValue: 20, endValue: 45, style: { fill: '#FFA200', stroke: '#FFA200' } }, { startValue: 45, endValue: 70, style: { fill: '#FF4800', stroke: '#FF4800' } }] }); ``` The startValue and endValue are indicating the end and the start of the range. ##### Pointer The default value of the pointer of jqxLinearGauge is: ```javascript const pointer = { pointerType: 'default', style: { fill: 'theme-specific-color', stroke: 'theme-specific-color' }, size: '7%', visible: true, offset: 0 }; ``` The pointer of the gauge have two different shapes. The first one is a column and the second one is an arrow. They could be switched using the pointerType property. For column pointer set the pointerType to 'default' for arrow set it to 'arrow'. The code bellow will set the pointer type to arrow: ```javascript $('#gauge').jqxLinearGauge({ pointer: { pointerType: 'arrow' }}); ``` The size of the pointer is setting through the size property which could be in percentage or in pixels. Pointer's style (fill and stroke color for example) could be set via the style property. It's default value is based on the colorScheme. ##### Background and Animation The 'background' property specifies the Linear Gauge's background fill, stroke and shape. It's default value is: ```javascript { showGradient: true, borderRadius: 15, style: { stroke: '#cccccc', fill: 'default-gradient'}, visible: true, backgroundType: 'roundedRectangle' } ``` Let's take a look at the different properties. Background's fill and stroke could be set using the style property. It's default style is gradient colored in '#cccccc'. The gradient could be disabled using the showGradient property. By setting it to false a solid color will be used. There are two built-in shapes for the background - rectangle and roundedRectangle. These different backgrounds could be switched using the backgroundType property. Let's change it's value to 'rectangle': ```javascript $('#gauge').jqxLinearGauge('background', { style: { stroke: '#cccccc', fill: '#cccccc' }, backgroundType: 'rectangle' }); ``` The upper code will change the background style to rectangle with stroke and background color '#cccccc'. If you set the backgroundType property to 'roundedRectangle' you could set it's border radius using the borderRadius property. You can hide jqxLinearGauge's background setting the visible property to false: ```javascript $('#gauge').jqxLinearGauge('background', { visible: false }); ``` The duration of the value changing animation is specified by the 'animationDuration' property. The 'easing' property specifies the easing of the value changing animation. Possible values are: 'linear', 'easeOutBack', 'easeInQuad', 'easeInOutCirc', 'easeInOutSine'. --- ### jQuery Gauge API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgauge/jquery-gauge-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxgauge.txt #### Properties - `animationDuration` (Type: Number, Default: 400): Sets or gets jqxGauge's animation duration [ms]. - `border` (Type: Object, Default: { size: '10%', style: { stroke: '#cccccc'}, visible: true, showGradient: true }): Sets or gets the gauge's properties for it's border. - `caption` (Type: Object, Default: { value: '', position: 'bottom', offset: [0, 0], visible: true }): Sets or gets the gauge's properties for it's caption. - `cap` (Type: Object, Default: { size: '4%', style: { fill: 'theme-specific-color', stroke: 'theme-specific-color' } , visible: true }): Sets or gets the gauge's properties for it's cap. - `colorScheme` (Type: String, Default: 'scheme01'): Sets the gauge's color palette. jqxGauge supports 11 color schemes from 'scheme01' to 'scheme11'. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the jqxGauge is disabled. - `easing` (Type: String, Default: linear): Sets or gets jqxGauge's animation easing. - `endAngle` (Type: Number, Default: 270): Sets or gets gauge's endAngle. This property specifies the end of the gauge's scale and is measured in degrees. - `height` (Type: Number, Default: 350): Sets or gets the gauge's height. This property accepts size in pixels and percentage. - `int64` (Type: Boolean, Default: false): Enables the jqxGauge 64-bit number support. - `labels` (Type: Object, Default: { distance: '38%', position: 'none', interval: 20, offset: [0, -10], visible: true, formatValue: function (value) { return value; }}): Sets or gets the gauge's properties for it's labels. - `min` (Type: Number, Default: 0): Sets or gets gauge's minimum value. - `max` (Type: Number, Default: 220): Sets or gets jqxGauge's max value. - `pointer` (Type: Object, Default: { pointerType: 'default', style: { fill: 'theme-specific-color', stroke: 'theme-specific-color' }, length: '70%', width: '2%', visible: true }): Sets or gets the gauge's properties for it's pointer. - `radius` (Type: Number, Default: '50%'): Sets or gets gauge's radius. This property accepts size in pixels and percentage. - `ranges` (Type: Array, Default: []): This property is array of objects. Each object is different range. The range is colored area with specified size. - `startAngle` (Type: Number, Default: 30): Sets or gets gauge's startAngle. This property specifies the beginning of the gauge's scale and is measured in degrees. - `showRanges` (Type: Boolean, Default: true): This property indicates whether the gauge's ranges will be visible. - `style` (Type: Object, Default: { fill: '#ffffff', stroke: '#ffffff' }): Sets or gets the gauge's style. - `ticksMajor` (Type: Object, Default: { size: '10%', interval: 5, style: { stroke: '#898989'}, visible: true }): Sets or gets the gauge's properties for it's major ticks. - `ticksMinor` (Type: Object, Default: { size: '10%', interval: 5, style: { stroke: '#898989'}, visible: true }): Sets or gets the gauge's properties for it's minor ticks. - `ticksDistance` (Type: Number, Default: '20%"): Sets and gets the ticks position. This property can be specified using percents (between '0%' and '100%') or using pixels. - `value` (Type: Number, Default: 0): Sets or gets gauge's value. - `width` (Type: Number, Default: 350): Sets or gets the gauge's width. This property accepts size in pixels and percentage. #### Properties - `valueChanging` (Arguments: Object): The event is is triggered when the gauge's value is changing. - `valueChanged` (Arguments: Object): The event is is triggered when the gauge's value is changed. #### Properties - `disable` (Arguments: None, Return Value: None): This method disables the gauge. - `enable` (Type: None, Description: None): This method enables the gauge. - `val` (Type: Method): Sets or gets the value. #### Properties - `animationDuration` (Type: Number, Default: 1000): Sets or gets jqxLinearGauge's animation duration [ms]. - `background` (Type: Object, Default: { borderRadius: 15, style: { stroke: '#cccccc', fill: 'default-gradient'}, visible: true, backgroundType: 'roundedRectangle', showGradient: true }): Sets or gets the gauge's properties for it's background. - `colorScheme` (Type: String, Default: 'scheme01'): Sets the gauge's color palette. jqxLinearGauge supports 11 color schemes from 'scheme01' to 'scheme11'. - `disabled` (Type: Boolean, Default: false): Sets or gets whether the jqxLinearGauge is disabled. - `easing` (Type: String, Default: 'linear'): Sets or gets jqxLinearGauge's animation easing. - `height` (Type: Number, Default: 300): Sets or gets the gauge's height. This property accepts size in pixels and percentage. - `int64` (Type: Boolean, Default: false): Enables the jqxLinearGauge 64-bit number support. - `labels` (Type: Object, Default: { position: 'both', interval: 20, offset: 0, visible: true, formatValue: function (value, position) { return value; }}): Sets or gets the gauge's properties for it's labels. - `min` (Type: Number, Default: -60): Sets or gets gauge's minimum value. - `max` (Type: Number, Default: 40): Sets or gets jqxLinearGauge's max value. - `orientation` (Type: String, Default: 'vertical'): Sets or gets jqxLineaerGauge's orientation. - `pointer` (Type: Object, Default: { pointerType: 'default', style: { fill: 'theme-specific-color', stroke: 'theme-specific-color' }, size: '7%', visible: true, offset: 0 }): Sets or gets the gauge's properties for it's pointer. - `rangesOffset` (Type: Number, Default: 0): Sets or gets ranges offset from the ticks. - `rangeSize` (Type: Number/String, Default: '5%'): Sets or gets the size of the ranges. This property can be set in percentage or in pixels. - `ranges` (Type: Array, Default: []): This property is array from objects. Each object is different range. The range is colored area with specified size. - `showRanges` (Type: Boolean, Default: true): This property indicates whether the gauge's ranges will be visible. - `scaleStyle` (Type: Object, Default: { stroke: '#A1A1A1', 'stroke-width': 1 }): Sets or gets the style of the line connecting all the ticks. - `scaleLength` (Type: Number/String, Default: '90%'): Sets or gets the length of the scale. This property could be set in percentage or in pixels. - `ticksOffset` (Type: Array, Default: ['36%', '5%']): Sets or gets the offset of the ticks. The first element of the array is the left offset and the second one is the top offset. This property can be set in pixels or percentage. - `ticksPosition` (Type: String, Default: 'both'): Sets or gets jqxLineaerGauge's ticks position. - `ticksMinor` (Type: Object, Default: { size: '10%', interval: 5, style: { stroke: '#A1A1A1', 'stroke-width': 1 }, visible: true }): Sets or gets the gauge's properties for it's minor ticks. - `ticksMajor` (Type: Object, Default: { size: '10%', interval: 5, style: { stroke: '#A1A1A1', 'stroke-width': 1 }, visible: true }): Sets or gets the gauge's properties for it's major ticks. - `value` (Type: Number, Default: -50): Sets or gets gauge's value. - `width` (Type: Number, Default: 100): Sets or gets the gauge's width. This property accepts size in pixels and percentage. #### Properties - `valueChanging` (Arguments: Object): The event is raised when the gauge's value is changing. - `valueChanged` (Arguments: Object): The event is raised when the gauge's value is changed. #### Properties - `disable` (Arguments: None, Return Value: None): This method disables the gauge. - `enable` (Type: None, Description: None): This method enables the gauge. - `val` (Type: Method): Sets or gets the value. --- ### jQuery Grid Getting Started Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-getting-started.htm > jQuery Grid getting started: install jQWidgets, add jqxGrid to your app, see a complete example, then handle its events and call its methods. The Grid is a powerful JavaScript component that displays tabular data. It offers rich support for interacting with data, including paging, grouping, sorting, filtering and editing. #### Quick start - **Package:** `jqwidgets-scripts` - **Files:** `19` scripts, listed below - **Demos:** [jQuery Grid demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm) - **API:** [Properties, events and methods](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-chat-api.htm) jqxGrid in the [Default Functionality](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm) demo, with the Fluent theme (Tailwind Dark in dark mode). Load the styles and the Grid's scripts - from the jsDelivr CDN as here, or from `node_modules/jqwidgets-scripts/jqwidgets/` after `npm install jqwidgets-scripts`. jQuery is optional: `jqxcore.js` works on its own. ```html ``` Then create it on an element with `$('#grid').jqxGrid({ … })`. The [live demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm) show every option with its source code; the guide below explains them. #### Grid Features - Data Binding - our Grid supports the following data binding options: - Local Data - load the javascript data grid from a local array of objects. - Xml Data - load the javascript data grid from XML data source using AJAX. - JSON Data - load the javascript data grid from JSON data source using AJAX. - CSV Data - load the javascript data grid from CSV. - Tab Data - load the javascript data grid from Tab-Delimited (TSV). - Remote Data - load the grid from a server with fetch or the data adapter (datatype 'json' or 'xml'); for another domain, the server allows it with CORS. JSONP, an older technique, is still supported. - Virtual Data - jqxGrid can be populated with data on demand when the user scrolls or changes the current page. - Outlook-Style Grouping - the Grid can group data by dragging Grid columns into a toolbar above the Grid. Grouping can be achieved through API as well. - Sorting - one-click automatic sorting, selection of sort option from a context menu and sorting through API calls. The data grid automatically chooses the most appropriate comparison. Users can also implement and use a custom sort comparer functions. The sorting works well with all possible configurations including rows grouping and paging. - Filtering - users can filter data in two ways - through a context menu integrated in the Grid, or via a filter row. - Paging - Editing and Validation - Nested Grids - Row Details - Localization - Column Types - Columns Resizing - Columns Reorder - Columns Hierarchy - Pinned Columns - Foreign Columns - Cells Formatting - Custom Grid Filters - Custom Cells Rendering - Custom Cell Editors - Rows and Cells Selection - Aggregates - Export to Excel, XML, HTML, CSV, TSV, PDF and JSON - Printing - Responsive Size with Fluid dimensions - Accessibility - Keyboard Navigation - State Maintenance #### Getting Started Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly. The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxGrid widget requires the following files: ```html ``` jqxGrid does not need jQuery: jqxcore.js has the small DOM layer it uses, and you can still add jQuery if your page uses it. Include the jQWidgets core framework file - jqxcore.js, the jQWidgets data binding file - jqxdata.js, the main jqxGrid plug-in file - jqxgrid.js file, the jQWidgets Scrollbar plug-in - jqxbutton.js and jqxscrollbar.js(used for the Grid scrolling), the jQWidgets Menu plug-in - jqxmenu.js(used for the Grid Columns menu), jQWidgets DropDownList plug-in(used in the Grid Pager and Filtering panel) - jqxlistbox.js and jqxdropdownlist.js, and the base jQWidgets stylesheet - jqx.base.css: - jqxgrid.js - Base Grid. - jqxgrid.grouping.js - This module adds a grouping feature into the Grid(optional). - jqxgrid.sort.js - This module adds a sorting feature into the Grid(optional). - jqxgrid.filter.js - This module adds a filtering feature into the Grid(optional). - jqxgrid.pager.js - This module adds a paging feature into the Grid(optional). - jqxgrid.columnsresize.js - This module adds a columns resizing feature into the Grid(optional). - jqxgrid.columnsreorder.js - This module adds a columns reorder feature into the Grid(optional). - jqxgrid.selection.js - This module adds a rows selection feature into the Grid(optional). - jqxgrid.edit.js - This module adds a cell editing feature into the Grid(optional). - jqxgrid.aggregates.js - This module adds an option to display aggregates in the Grid(optional). - jqxgrid.storage.js - This module adds an option to save and load the Grid's state(optional). - jqxgrid.export.js and jqxdata.export.js - This module adds an option to export the Grid's data to Excel, XML, CSV, TSV, HTML and JSON(optional). The next step is to create a DIV element within the body of the html document. ```html
``` The last step is to initialize the widget. In order to initialize the Grid, you need to set its source and columns properties. Add the following script to the html document: ```javascript // prepare the data var data = new Array(); var firstNames = [ "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene"]; var lastNames = [ "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier"]; var productNames = [ "Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"]; var priceValues = [ "2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0"]; for (let i = 0; i < 1000; i++) { var row = {}; var productindex = Math.floor(Math.random() * productNames.length); var price = parseFloat(priceValues[productindex]); var quantity = 1 + Math.round(Math.random() * 10); row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)]; row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)]; row["productname"] = productNames[productindex]; row["price"] = price; row["quantity"] = quantity; row["total"] = price * quantity; data[i] = row; } var source = { localdata: data, datatype: "array" }; var dataAdapter = new $.jqx.dataAdapter(source, { loadComplete: function (data) {}, loadError: function (xhr, status, error) {} }); $("#jqxgrid").jqxGrid( { source: dataAdapter, columns: [ { text: 'First Name', datafield: 'firstname', width: 100 }, { text: 'Last Name', datafield: 'lastname', width: 100 }, { text: 'Product', datafield: 'productname', width: 180 }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' }, { text: 'Total', datafield: 'total', width: 100, cellsalign: 'right', cellsformat: 'c2' }] }); ``` To set a property(option), you need to pass the property name and value(s) in the jqxGrid's constructor. ```javascript $("#grid").jqxGrid({ disabled: true}); ``` To get a property(option), you need to pass the property name to the jqxGrid's constructor. ```javascript const disabled = $("#grid").jqxGrid('disabled'); ``` To call a function, you need to pass the function name and parameters(if any). ```javascript $("#jqxgrid").jqxGrid('selectrow', 1); ``` To bind to an event of a UI widget, you can use basic jQuery syntax. Let’s suppose that you want to get when the user selects a row. The example code below demonstrates how to bind to the ‘rowselect’ event of jqxGrid. ```javascript $("#jqxgrid").on('rowselect', function (event) { const rowindex = event.args.rowindex; }); ``` ##### Basic Grid Sample ```html This example shows how to create a Grid from Array data.
``` ##### The result of the above code is: Our Grid demos are available on: [jQuery Grid demos](https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm) #### Working in Svelte 5? We also build [SvGrid](https://svgrid.com/), a data grid for Svelte 5. Related links: - [Connect a Svelte grid to your backend](https://svgrid.com/blog/svelte-data-grid-integrations). - [Svelte Grid Docs](https://svgrid.com/docs/). - [Svelte Grid Demos](https://svgrid.com/demos/). - [Svelte Grid Pricing](https://svgrid.com/pricing/). - [Svelte Grids Comparison](https://svgrid.com/compare/) --- ### Grid Data Sources Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm > The Grid plugin can be bound to multiple types of data collections including arrays, xml, json, tsv, csv or remote data. The Grid plugin can be bound to multiple types of data collections including arrays, xml, json, tsv, csv or remote data. To data bind the Grid to a data source you need to set its source property to point to an instance of jqxDataAdapter. The source object represents a set of key/value pairs. - url: A string containing the URL to which the request is sent. - data: Data to be sent to the server. - localdata: data array or data string pointing to a local data source. - datatype: the data's type. Possible values: 'xml', 'json', 'jsonp', 'tsv', 'csv', 'local', 'array', 'observablearray'. - type: The type of request to make ("POST" or "GET"), default is "GET". - id: A string containing the Id data field. - root: A string describing where the data begins and all other loops begin from this element. - record: A string describing the information for a particular record. XML ```javascript const source = { datatype: "xml", datafields: [ { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: 'orders.xml' }; ``` ```html http://services.odata.org/Northwind/Northwind.svc/Orders(10248) 2011-12-01T11:55:06Z 10248 VINET 5 2026-07-02T00:00:00 2026-07-30T00:00:00 2026-07-14T00:00:00 3 32.3800 Vins et alcools Chevalier 59 rue de l'Abbaye Reims 51100 France http://services.odata.org/Northwind/Northwind.svc/Orders(10249) 2011-12-01T11:55:06Z 10249 TOMSP 6 2026-07-03T00:00:00 2026-08-14T00:00:00 2026-07-08T00:00:00 1 11.6100 Toms Spezialitäten Luisenstr. 48 Münster 44087 Germany ``` - datafields: An array describing the fields in a particular record. Each datafield must define the following members: - name - A string containing the data field's name. - type - A string containing the data field's type. Possible values: 'string', 'date', 'number', 'float', 'int', 'bool'. - format(optional) - Sets the data formatting. By setting the format, the jqxDataAdapter plug-in will try to format the data before loading it. Example: { name: 'SubmitDate', type: 'date', format: "yyyy-MM-ddTHH:mm:ss-HH:mm" } - map(optional) - A mapping to the data field. Example with XML data: XML Example with nested JSON data. Example #2 with XML Attributes Let's load the following data into the Grid from a file named customers.xml. Initialize the jqxDataAdapter plug-in. Initialize the jqxGrid. Example #3 with nested JSON data. ```javascript { name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' } ``` ```html ALFKI Alfreds Futterkiste Maria Anders Sales Representative Obere Str. 57 Berlin 12209 Germany 030-0074321 030-0076545 ``` ```javascript const data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi" }]; // prepare the data const source = { datatype: "json", datafields: [ { name: 'empName' }, { name: 'age' }, { name: 'id', map: 'department>id' }, { name: 'name', map: 'department>name' }, { name: 'author' }], localdata: data }; const dataAdapter = new $.jqx.dataAdapter(source); ``` ```xml ``` ```javascript const url = "../sampledata/customers.xml"; // prepare the data const source = { datatype: "xml", datafields: [ { name: 'CustomerID', map: '[CustomerID]' }, { name: 'Name', map: '[Name]' }], root: "Customers", record: "Customer", url: url }; const dataAdapter = new $.jqx.dataAdapter(source); ``` ```javascript $("#jqxgrid").jqxGrid( { width: 400, source: dataAdapter, columns: [ { text: 'ID', datafield: 'CustomerID', width: 250 }, { text: 'Name', datafield: 'Name', width: 150 } ] }); ``` ```javascript const data = [ { "state": { "id": "x526", "city": { "name": "Beverly Hills", "id": 90210, "value": "Beverly Hills" } } }]; const source = { datatype: 'json', localdata: data, datafields: [ { name: 'cityName', map: 'state>city>name' }] }; const dataAdapter = new $.jqx.dataAdapter(source); ``` - values - determines the foreign collection associated to the data field. ```javascript var employeesSource = { datatype: "xml", datafields: [ { name: 'FirstName', type: 'string' }, { name: 'LastName', type: 'string' }], root: "Employees", record: "Employee", id: 'EmployeeID', url: "../sampledata/employees.xml", async: false }; var employeesAdapter = new $.jqx.dataAdapter(employeesSource, { autoBind: true, beforeLoadComplete: function (records) { const data = new Array(); // update the loaded records. Dynamically add EmployeeName and EmployeeID fields. for (let i = 0; i < records.length; i++) { var employee = records[i]; employee.EmployeeName = employee.FirstName + " " + employee.LastName; employee.EmployeeID = employee.uid; data.push(employee); } return data; } }); // prepare the data var ordersSource = { datatype: "xml", datafields: [ // name - determines the field's name. // value - the field's value in the data source. // values - specifies the field's values. // values.source - specifies the foreign source. The expected value is an array. // values.value - specifies the field's name in the foreign source. // values.name - specifies the field's value in the foreign source. // When the ordersAdapter is loaded, each record will have a field called "EmployeeName". The "EmployeeName" for each record comes from the employeesAdapter where the record's "EmployeeID" from orders.xml matches to the "EmployeeID" from employees.xml. { name: 'EmployeeName', value: 'EmployeeID', values: { source: employeesAdapter.records, value: 'EmployeeID', name: 'EmployeeName' } }, { name: 'EmployeeID', map: 'm\\:properties>d\\:EmployeeID' }, { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: "../sampledata/orders.xml", pager: function (pagenum, pagesize, oldpagenum) { // callback called when a page or page size is changed. } }; var ordersAdapter = new $.jqx.dataAdapter(ordersSource); ``` - pagenum - determines the initial page number when paging is enabled. - pagesize - determines the page size when paging is enabled. - pager - callback function called when the current page or page size is changed. ```javascript pager: function (pagenum, pagesize, oldpagenum) { } ``` - sortcolumn - determines the initial sort column. The expected value is a data field name. - sortdirection - determines the sort order. The expected value is 'asc' for (A to Z) sorting or 'desc' for (Z to A) sorting. - sort - callback function called when the sort column or sort order is changed. ```javascript sort: function (column, direction) { } ``` - filter - callback function called when a filter is applied or removed. ```javascript filter: function (filters, recordsArray) { } ``` - addrow - callback function, called when a new row is/are added. If multiple rows are added, the rowid and rowdata parameters are arrays of row ids and rows. ```javascript addrow: function (rowid, rowdata, position, commit) { // synchronize with the server - send insert command // call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. commit(true); } ``` - deleterow - callback function, called when a row is deleted. If multiple rows are deleted, the rowid parameter is an array of row ids. ```javascript deleterow: function (rowid, commit) { // synchronize with the server - send delete command // call commit with parameter true if the synchronization with the server is successful //and with parameter false if the synchronization failed. commit(true); } ``` - updaterow - callback function, called when a row is updated. If multiple rows are added, the rowid and rowdata parameters are arrays of row ids and rows. Example: ```javascript updaterow: function (rowid, newdata, commit) { // synchronize with the server - send update command // call commit with parameter true if the synchronization with the server is successful // and with parameter false if the synchronization failed. commit(true); } ``` - processdata - extend the default data object sent to the server. ```javascript var source = { datatype: "jsonp", datafields: [ { name: 'countryName' }, { name: 'name' }, { name: 'population', type: 'float' }, { name: 'continentCode' }], url: "http://ws.geonames.org/searchJSON", processdata: function (data) { data.featureClass = "P";; data.style = "full"; data.maxRows = 50; } }; ``` - formatdata - Before the data is sent to the server, you can fully override it by using the 'formatdata' function of the source object. The result that the 'formatdata' function returns is actually what will be sent to the server. ```javascript var source = { datatype: "jsonp", datafields: [ { name: 'countryName' }, { name: 'name' }, { name: 'population', type: 'float' }, { name: 'continentCode' }], url: "http://ws.geonames.org/searchJSON", data: { featureClass: "P", style: "full", maxRows: 50 }, formatdata: function (data) { return "my data"; } }; ``` - contenttype: Use this option, If you want to explicitly pass in a content-type. Default is "application/x-www-form-urlencoded". The example code below illustrates how to create jqxDataAdapter from a source object. ```javascript var dataAdapter = new $.jqx.dataAdapter(source, { loadComplete: function (data) { // data is loaded. }, loadError: function (xhr, status, error) { // data is not loaded. } }); ``` If you bind the Grid to remote data source using asynchronous requests(that is by default when you specify url in the source object and you didn't set the async field to false), then make sure that you call any method or set a property once the data is loaded. To ensure that you call your code when the Grid is loaded with data, use the Grid's ready callback function or bind to the 'bindingcomplete' event before the Grid's initialization and call your code inside the event handler. Example with 'ready' callback: ```javascript var url = "../sampledata/beverages.txt"; // prepare the data var source = { datatype: "json", datafields: [ { name: 'name' }, { name: 'type' }, { name: 'calories', type: 'int' }, { name: 'totalfat' }, { name: 'protein' }], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 400, source: dataAdapter, ready: function () { $("#jqxgrid").jqxGrid('hidecolumn', 'name'); }, columnsresize: true, columns: [ { text: 'Name', datafield: 'name', width: 250 }, { text: 'Beverage Type', datafield: 'type', width: 250 }, { text: 'Calories', datafield: 'calories', width: 180 }, { text: 'Total Fat', datafield: 'totalfat', width: 120 }, { text: 'Protein', datafield: 'protein', minwidth: 120 }] }); ``` Example with 'bindingcomplete': ```javascript var url = "../sampledata/beverages.txt"; // prepare the data var source = { datatype: "json", datafields: [ { name: 'name' }, { name: 'type' }, { name: 'calories', type: 'int' }, { name: 'totalfat' }, { name: 'protein' }], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").on('bindingcomplete', function (event) { $("#jqxgrid").jqxGrid('hidecolumn', 'name'); }); $("#jqxgrid").jqxGrid( { width: 400, source: dataAdapter, columnsresize: true, columns: [ { text: 'Name', datafield: 'name', width: 250 }, { text: 'Beverage Type', datafield: 'type', width: 250 }, { text: 'Calories', datafield: 'calories', width: 180 }, { text: 'Total Fat', datafield: 'totalfat', width: 120 }, { text: 'Protein', datafield: 'protein', minwidth: 120 }] }); ``` Initialize a Grid with the `source` property specified. #### Bind the Grid to an array. The data member is array. The datatype member is set to "array". ```html Grid populated from Array.
``` #### What happens when the data source is changed? How to refresh the Grid? To refresh the Grid, you need to simply set its 'source' property again. ```html Grid populated from Array.
``` #### Bind the Grid to XML data. In the source initialization, you need to set the following: - url of a xml file. - record - this is the data record which will be displayed as a row in the Grid. - datafields - the record's member names. You can also specify the mapping to the member's data. ```xml Customers 2012-11-30T11:39:28Z 2012-11-30T11:39:28Z ALFKI Alfreds Futterkiste Maria Anders Sales Representative Obere Str. 57 Berlin 12209 Germany 030-0074321 030-0076545 ``` ```html This example shows how to create a Grid from XML data.
``` #### The result of the above code is: You can also set the datafield's type in the source object initialization. ```javascript const source = { datatype: "xml", datafields: [ { name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' }, { name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' }, { name: 'ShipName', map: 'm\\:properties>d\\:ShipName' }, { name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' }, { name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' }, { name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }], root: "entry", record: "content", id: 'm\\:properties>d\\:OrderID', url: url, sortcolumn: 'ShipName', sortdirection: 'asc' }; ``` The sortcolumn and sortdirection properties in the above code apply a sorting and a sort order to a Grid column. #### Bind the Grid to JSON data. When you bind the Grid to JSON data, you need to set the source object's datatype to 'json'. ```json [{ "id": "1", "name": "Hot Chocolate", "type": "Chocolate Beverage", "calories": "370", "totalfat": "16g", "protein": "14g" }, { "id": 2, "name": "Peppermint Hot Chocolate", "type": "Chocolate Beverage", "calories": "440", "totalfat": "16g", "protein": "13g" }, { "id": "3", "name": "Salted Caramel Hot Chocolate", "type": "Chocolate Beverage", "calories": "450", "totalfat": "16g", "protein": "13g" }, { "id": "4", "name": "White Hot Chocolate", "type": "Chocolate Beverage", "calories": "420", "totalfat": "16g", "protein": "12g" }, { "id": "5", "name": "Caffe Americano", "type": "Espresso Beverage", "calories": "15", "totalfat": "0g", "protein": "1g" }, { "id": "6", "name": "Caffe Latte", "type": "Espresso Beverage", "calories": "190", "totalfat": "7g", "protein": "12g" }, { "id": "7", "name": "Caffe Mocha", "type": "Espresso Beverage", "calories": "330", "totalfat": "15g", "protein": "13g" }, { "id": "8", "name": "Cappuccino", "type": "Espresso Beverage", "calories": "120", "totalfat": "4g", "protein": "8g" }, { "id": "9", "name": "Caramel Brulee Latte", "type": "Espresso Beverage", "calories": "420", "totalfat": "9g", "protein": "8g" }, { "id": "10", "name": "Caramel Macchiato", "type": "Espresso Beverage", "calories": "240", "totalfat": "11g", "protein": "10g" }, { "id": "11", "name": "Peppermint Hot Chocolate", "type": "Espresso Beverage", "calories": "440", "totalfat": "10g", "protein": "13g" }, { "id": "12", "name": "Cinnamon Dolce Latte", "type": "Espresso Beverage", "calories": "260", "totalfat": "6g", "protein": "10g" }, { "id": "13", "name": "Eggnog Latte", "type": "Espresso Beverage", "calories": "460", "totalfat": "16g", "protein": "13g" }, { "id": "14", "name": "Espresso", "type": "Espresso Beverage", "calories": "5", "totalfat": "1g", "protein": "1g" }, { "id": "15", "name": "Espresso Con Panna", "type": "Espresso Beverage", "calories": "30", "totalfat": "1g", "protein": "0g" }, { "id": "16", "name": "Espresso Macchiato", "type": "Espresso Beverage", "calories": "100", "totalfat": "1g", "protein": "0g" }, { "id": "17", "name": "Flavored Latte", "type": "Espresso Beverage", "calories": "250", "totalfat": "6g", "protein": "12g" }, { "id": "18", "name": "Gingerbread Latte", "type": "Espresso Beverage", "calories": "320", "totalfat": "13g", "protein": "12g" }, { "id": "19", "name": "White Chocolate Mocha", "type": "Espresso Beverage", "calories": "470", "totalfat": "18g", "protein": "15g" }, { "id": 20, "name": "Skinny Peppermint Mocha", "type": "Espresso Beverage", "calories": 130, "totalfat": "15g", "protein": "13g" }, { "id": "21", "name": "Skinny Flavored Latte", "type": "Espresso Beverage", "calories": "120", "totalfat": "0g", "protein": "12g" }, { "id": "22", "name": "Pumpkin Spice Latte", "type": "Espresso Beverage", "calories": "380", "totalfat": "13g", "protein": "14g" }, { "id": "23", "name": "Caffe Vanilla Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "310", "totalfat": "3g", "protein": "3g" }, { "id": "24", "name": "Caffe Vanilla Frappuccino Light", "type": "Frappuccino Blended Beverage", "calories": "180", "totalfat": "0g", "protein": "3g" }, { "id": "25", "name": "Caramel Brulee Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "410", "totalfat": "13g", "protein": "4g" }, { "id": "26", "name": "Caramel Brulee Frappuccino Light", "type": "Frappuccino Blended Beverage", "calories": "190", "totalfat": "0g", "protein": "3g" }, { "id": "27", "name": "Eggnog Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "420", "totalfat": "18g", "protein": "7g" }, { "id": "28", "name": "Mocha Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "400", "totalfat": "15g", "protein": "5g" }, { "id": "29", "name": "Tazo Green Tea Creme Frappuccino", "type": "Frappuccino Blended Beverage", "calories": "430", "totalfat": "16g", "protein": "6g" }] ``` ```html Grid populated from JSON.
``` #### The result of the above code is: If you want to bind the Grid to JSONP data, then you need to set the source object's datatype to 'jsonp'. #### Bind the Grid to tab-separated values (TSV). When you bind the Grid to TSV data, you need to set the source object's datatype to 'tab'. ```html This example shows how to create a Grid from Tab-delimited text also known as tab-separated values (TSV).
``` #### Bind the Grid to comma-separated values (CSV). When you bind the Grid to CSV data, you need to set the source object's datatype to 'csv'. ```html This example shows how to create a Grid from Tab-delimited text also known as tab-separated values (TSV).
``` #### The result of the above code is: Additional properties of the source object: - mapChar - specifies the mapping char. By default it is '>'. In the following code, if the mapChar was set to '.', we should use '.' instead of '>' to specify the fields map. ```javascript const data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi" }]; // prepare the data const source = { datatype: "json", datafields: [ { name: 'empName' }, { name: 'age' }, { name: 'id', map: 'department>id' }, { name: 'name', map: 'department>name' }, { name: 'author' }], localdata: data }; const dataAdapter = new $.jqx.dataAdapter(source); ``` - columnDelimiter - specifies the column delimiter when the data source is 'tab' or 'csv'. The default value for 'tab' is '\t' and the default value for 'csv' is ','. - rowDelimiter - specifies the rows delimiter when the data source is 'tab' or 'csv'. The default value is '\n'. --- ### Grid Sorting Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-sorting.htm > The sortable property enables or disables the data sorting. The Grid sorting logic is implemented in the jqxgrid.sort.js and you need to reference that… **(requires jqxgrid.sort.js)** The sortable property enables or disables the data sorting. The Grid sorting logic is implemented in the jqxgrid.sort.js and you need to reference that javascript file. In the code example below, the Grid data sorting is enabled. ```javascript $("#jqxgrid").jqxGrid( { width: 670, height: 450, source: source, theme: theme, sortable: true, columns: [ { text: 'Ship Name', datafield: 'ShipName', width: 250 }, { text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' }, { text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' }, { text: 'Ship Address', datafield: 'ShipAddress', width: 350 }, { text: 'Ship City', datafield: 'ShipCity', width: 100 }, { text: 'Ship Country', datafield: 'ShipCountry', width: 100 } ] }); ``` To enable or disable the sorting of a Grid column, you can set its sortable property to false. In the code example below, the sorting of the "ShipName" column is disabled. ```javascript $("#jqxgrid").jqxGrid( { width: 670, height: 450, source: source, theme: theme, sortable: true, columns: [ { text: 'Ship Name', datafield: 'ShipName', width: 250, sortable: false }, { text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' }, { text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' }, { text: 'Ship Address', datafield: 'ShipAddress', width: 350 }, { text: 'Ship City', datafield: 'ShipCity', width: 100 }, { text: 'Ship Country', datafield: 'ShipCountry', width: 100 } ] }); ``` When the sorting data type is Date, Number or Boolean, the 'type' property in the 'datafields' array should be set. In this code example, the data type of the ShippedDate column is Date and the "type" property is set to "date". The Freight column displays floating-point numbers and the 'type' property is set to 'float'. ```javascript const source = { datatype: "xml", datafields: [ { name: 'ShippedDate', type: 'date' }, { name: 'Freight', type: 'float' }, { name: 'ShipName' }, { name: 'ShipAddress' }, { name: 'ShipCity' }, { name: 'ShipCountry' }], root: "entry", record: "content", id: 'OrderID', url: url, sortcolumn: 'ShipName', sortdirection: 'asc' }; ``` The 'sortcolumn' property specifies the default Grid sort column, i.e. when the grid is displayed, the data will be sorted. The 'sortdirection' property specifies the sort order of the sort column. Sorting with the Grid API. The sortby function can be used to sort the Grid through the API. This function should be called when the grid data is fully loaded. The first parameter is the Column's DataField. The second parameter is the sort order - 'asc' or 'desc'. ```javascript $("#jqxgrid").on('bindingcomplete', function () { $("#jqxgrid").jqxGrid('sortby', 'ShipName', 'asc'); }); ``` To remove the sorting, call the "removesort" function. When the data is sorted, the Grid raises the 'sort' event. ```javascript $("#jqxgrid").on("sort", function (event) { const sortinformation = event.args.sortinformation; const sortdirection = sortinformation.sortdirection; const sortcolumn = sortinformation.sortcolumn; }); ``` By default, when the sorting is enabled and the user clicks a column's header, the sort order is changed. The jqxGrid 'sorttogglestates' property can be used to modify this behavior. The possible values of this property are: 0 - disables toggling. The Grid is sortable only through the API. 1 - enables togging. Click on a column header toggles the sort direction. In this mode, there are 2 possible sort direction values - 'asc', and 'desc'. 2 - default toggle mode. Click on a column header toggles the sort direction. In this mode, there are 3 possible sort direction values - 'asc', 'desc' and null. When the sort direction is null, the sorting is cleared. To override the default sorting logic, you need to set the 'sort' member of the Grid's source object to a custom sorting function. The Grid will pass two parameters to this function - the sort column's datafield and the sort direction. For Server-Side sorting, see the [Server-side processing with PHP and MySQL help topic](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-php-server-side-processing.htm). --- ### Grid Filtering Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-filtering.htm > To enable the filtering feature, you need to set the 'filterable' property to true and add a reference to the jqxgrid.filter.js file. **(requires jqxgrid.filter.js)** To enable the filtering feature, you need to set the 'filterable' property to true and add a reference to the jqxgrid.filter.js file. When the value of the filterable property is true, the Grid displays a filtering panel in the columns popup menus. jqxGrid has several methods that allow you to handle the data filtering – addfilter, removefilter, applyfilters and clearfilters. The first method adds a filter to a grid column. The ‘removefilter’ method removes a filter from a grid column. The ‘applyfilters’ method applies all filters to the grid and refreshes its contents. The last method clears the filtering. Let’s see how to add a filter: 1. The first step is to create a filter group. The filter group is a group of one or more filtering criteria. ```javascript const filtergroup = new $.jqx.filter(); ``` 2. The next step is to create the filters. Each filter must have a filter value – this is the value we compare each cell value with. The filter condition specifies how the filter will compare each cell value with the filter value. The filter condition value depends on the filter’s type(jqxGrid supports string, numeric and date filters). If you want to get the list of the supported grid filtering conditions, you can use the ‘getoperatorsbyfiltertype’ method of filter group.The createfilter method is used to create the filter. ```javascript let filtervalue = 'Beate'; let filtercondition = 'contains'; // possible conditions for string filter: 'EMPTY', 'NOT_EMPTY', 'CONTAINS', 'CONTAINS_CASE_SENSITIVE', // 'DOES_NOT_CONTAIN', 'DOES_NOT_CONTAIN_CASE_SENSITIVE', 'STARTS_WITH', 'STARTS_WITH_CASE_SENSITIVE', // 'ENDS_WITH', 'ENDS_WITH_CASE_SENSITIVE', 'EQUAL', 'EQUAL_CASE_SENSITIVE', 'NULL', 'NOT_NULL' // possible conditions for numeric filter: 'EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL' // possible conditions for date filter: 'EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL' const filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); filtervalue = 'Andrew'; filtercondition = 'starts_with'; const filter2 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); ``` 3. The third step is to add the filters to the filter group. In the code example below, we added two filters in the filter group with operator ‘or’. This means that each cell value will be evaluated by filter1 and filter2 and the evaluation result will be true, if the filter1′s returned value is true or filter2′s returned value is true. ```javascript const filter_or_operator = 1; filtergroup.addfilter(filter_or_operator, filter1); filtergroup.addfilter(filter_or_operator, filter2); ``` 4. In the final step, we add the filter group to the first column and apply the filters by calling the ‘applyfilters’ method. ```javascript // add the filters. $("#jqxgrid").jqxGrid('addfilter', 'firstname', filtergroup); // apply the filters. $("#jqxgrid").jqxGrid('applyfilters'); ``` If you want to remove the filter, call the ‘removefilter’ method and then the ‘applyfilters’ method. ```javascript $("#jqxgrid").jqxGrid('removefilter', 'firstname'); $("#jqxgrid").jqxGrid('applyfilters'); ``` If you want to clear all filters, use the ‘clearfilters’ method. ```javascript $("#jqxgrid").jqxGrid('clearfilters'); ``` For Server-Side filtering, see the [Server-side processing with PHP and MySQL help topic](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-php-server-side-processing.htm). #### Custom Filter Conditions To customize the filter conditions, you need to do the following: 1. Update the Localization Strings. The filter conditions displayed in the filter dropdowns are loaded from the jqxGrid's localization object. *Bind to the bindingcomplete event before the Grid's initialization. ```javascript $("#jqxgrid").on('bindingcomplete', function () { const localizationobj = {}; filterstringcomparisonoperators = ['empty', 'not empty', 'contains', 'contains(match case)', 'does not contain', 'does not contain(match case)', 'starts with', 'starts with(match case)', 'ends with', 'ends with(match case)', 'equal', 'equal(match case)', 'null', 'not null']; filternumericcomparisonoperators = ['equal', 'not equal', 'less than', 'less than or equal', 'greater than', 'greater than or equal', 'null', 'not null']; filterdatecomparisonoperators = ['equal', 'not equal', 'less than', 'less than or equal', 'greater than', 'greater than or equal', 'null', 'not null']; filterbooleancomparisonoperators = ['equal', 'not equal']; localizationobj.filterstringcomparisonoperators = filterstringcomparisonoperators; localizationobj.filternumericcomparisonoperators = filternumericcomparisonoperators; localizationobj.filterdatecomparisonoperators = filterdatecomparisonoperators; localizationobj.filterbooleancomparisonoperators = filterbooleancomparisonoperators; // apply localization. $("#jqxgrid").jqxGrid('localizestrings', localizationobj); }); ``` 2. The second step is to update the conditions within the Filter object. In order to achieve that, you need to add a function called "updatefilterconditions". That function is invoked by jqxGrid with 2 parameters - the type of the filter and the default filter conditions. As a result, the function should return an array of strings depending on the filter's type. That array will be used by the filter object.. ```javascript $("#jqxgrid").jqxGrid( { source: source, filterable: true, sortable: true, updatefilterconditions: function (type, defaultconditions) { const stringcomparisonoperators = ['EMPTY', 'NOT_EMPTY', 'CONTAINS', 'CONTAINS_CASE_SENSITIVE', 'DOES_NOT_CONTAIN', 'DOES_NOT_CONTAIN_CASE_SENSITIVE', 'STARTS_WITH', 'STARTS_WITH_CASE_SENSITIVE', 'ENDS_WITH', 'ENDS_WITH_CASE_SENSITIVE', 'EQUAL', 'EQUAL_CASE_SENSITIVE', 'NULL', 'NOT_NULL']; const numericcomparisonoperators = ['EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL']; const datecomparisonoperators = ['EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL']; const booleancomparisonoperators = ['EQUAL', 'NOT_EQUAL']; switch (type) { case 'stringfilter': return stringcomparisonoperators; case 'numericfilter': return numericcomparisonoperators; case 'datefilter': return datecomparisonoperators; case 'booleanfilter': return booleancomparisonoperators; } }, autoshowfiltericon: true, columns: [ { text: 'First Name', datafield: 'firstname', width: 100 }, { text: 'Last Name', datafield: 'lastname', width: 100 }, { text: 'Product', datafield: 'productname', width: 180 }, { text: 'Order Date', datafield: 'date', width: 100, cellsformat: 'd' }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' }] }); ``` #### Add filters to multiple columns through the API. ```javascript var data = generatedata(500); var source = { localdata: data, datatype: "array" }; var addfilter = function () { // create a filter group for the FirstName column. const fnameFilterGroup = new $.jqx.filter(); // operator between the filters in the filter group. 1 is for OR. 0 is for AND. var filter_or_operator = 1; // create a string filter with 'contains' condition. var filtervalue = 'Beate'; var filtercondition = 'contains'; const fnameFilter1 = fnameFilterGroup.createfilter('stringfilter', filtervalue, filtercondition); // create second filter. filtervalue = 'Andrew'; filtercondition = 'starts_with'; const fnameFilter2 = fnameFilterGroup.createfilter('stringfilter', filtervalue, filtercondition); // add the filters to the filter group. fnameFilterGroup.addfilter(filter_or_operator, fnameFilter1); fnameFilterGroup.addfilter(filter_or_operator, fnameFilter2); // add the filter group to the 'firstname' column in the Grid. $("#jqxgrid").jqxGrid('addfilter', 'firstname', fnameFilterGroup); // create a filter group for the Quantity column. const quantityFilterGroup = new $.jqx.filter(); // create a filter. var filter_or_operator = 1; var filtervalue = 3; var filtercondition = 'less_than'; const quantityFilter1 = quantityFilterGroup.createfilter('numericfilter', filtervalue, filtercondition); quantityFilterGroup.addfilter(filter_or_operator, quantityFilter1); // add the filter group to the 'quantity' column in the Grid. $("#jqxgrid").jqxGrid('addfilter', 'quantity', quantityFilterGroup); // apply the filters. $("#jqxgrid").jqxGrid('applyfilters'); }; var adapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 670, source: adapter, filterable: true, sortable: true, ready: function () { addfilter(); }, autoshowfiltericon: true, columns: [ { text: 'First Name', datafield: 'firstname', width: 90 }, { text: 'Last Name', datafield: 'lastname', width: 90 }, { text: 'Product', datafield: 'productname', width: 170 }, { text: 'Order Date', datafield: 'date', width: 160, cellsformat: 'dd-MMMM-yyyy' }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' }] }); ``` *generatedata function is implemented in the generatedata.js. The file is included in the download package and can be found in the installation_folder/demos/jqxgrid folder. By default the filter groups are combined with 'AND' operator. That means that the Grid will display records if they meet the criteria of the filter group applied to column 1 and the filter group applied to column 2, etc. You can create any combination of filter groups using 'AND' and 'OR'. The example below illustrates how: ```javascript var data = generatedata(500); var source = { localdata: data, datatype: "array" }; var addfilter = function () { // create a filter group for the FirstName column. const fnameFilterGroup = new $.jqx.filter(); fnameFilterGroup.operator = 'or'; // operator between the filters in the filter group. 1 is for OR. 0 is for AND. var filter_or_operator = 1; // create a string filter with 'contains' condition. var filtervalue = 'Beate'; var filtercondition = 'contains'; const fnameFilter1 = fnameFilterGroup.createfilter('stringfilter', filtervalue, filtercondition); // create second filter. filtervalue = 'Andrew'; filtercondition = 'starts_with'; const fnameFilter2 = fnameFilterGroup.createfilter('stringfilter', filtervalue, filtercondition); // add the filters to the filter group. fnameFilterGroup.addfilter(filter_or_operator, fnameFilter1); fnameFilterGroup.addfilter(filter_or_operator, fnameFilter2); // add the filter group to the 'firstname' column in the Grid. $("#jqxgrid").jqxGrid('addfilter', 'firstname', fnameFilterGroup); // create a filter group for the Quantity column. const quantityFilterGroup = new $.jqx.filter(); quantityFilterGroup.operator = 'or'; // create a filter. var filter_or_operator = 1; var filtervalue = 3; var filtercondition = 'less_than'; const quantityFilter1 = quantityFilterGroup.createfilter('numericfilter', filtervalue, filtercondition); quantityFilterGroup.addfilter(filter_or_operator, quantityFilter1); // add the filter group to the 'quantity' column in the Grid. $("#jqxgrid").jqxGrid('addfilter', 'quantity', quantityFilterGroup); // apply the filters. $("#jqxgrid").jqxGrid('applyfilters'); }; var adapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { source: adapter, filterable: true, sortable: true, ready: function () { addfilter(); }, autoshowfiltericon: true, columns: [ { text: 'First Name', datafield: 'firstname', width: 90 }, { text: 'Last Name', datafield: 'lastname', width: 90 }, { text: 'Product', datafield: 'productname', width: 170 }, { text: 'Order Date', datafield: 'date', width: 160, cellsformat: 'dd-MMMM-yyyy' }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' }] }); ``` Using te above code, jqxGrid will display any record which meets at least one of the filtering criteria i.e a record is displayed, if it meets the condition of the 'FirstName' column's filter group or the one of the 'Quantity' column's filter group. --- ### Paging Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-paging.htm > The Grid plugin has a built-in paging capability that supports paging functionality. **(requires jqxgrid.pager.js)** The Grid plugin has a built-in paging capability that supports paging functionality. The paging functionality is implemented in the jqxgrid.pager.js and is enabled when the 'pageable' property is set to true. The code example below illustrates how to enable the paging functionality. ```javascript $("#jqxgrid").jqxGrid( { source: source, pageable: true, autoheight: true, columns: [ { text: 'Ship Name', datafield: 'ShipName', width: 250 }, { text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' }, { text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' }, { text: 'Ship Address', datafield: 'ShipAddress', width: 350 }, { text: 'Ship City', datafield: 'ShipCity', width: 100 }, { text: 'Ship Country', datafield: 'ShipCountry', width: 101 } ] }); ``` When a page is changed or the page size is changed, the Grid raises the pagechanged or pagesizechanged events. ```javascript $("#jqxgrid").on("pagechanged", function (event) { const args = event.args; const pagenumber = args.pagenum; const pagesize = args.pagesize; }); $("#jqxgrid").on("pagesizechanged", function (event) { const args = event.args; const pagenumber = args.pagenum; const pagesize = args.pagesize; }); ``` #### Basic Grid with Paging ```html This example illustrates how to customize the Grid plugin's Pager.
``` #### The result of the above code is: The Grid Page Size options are displayed in a DropDownList plugin in the pager area. By default, the size options are 5, 10 and 20. The 'pagesizeoptions' property enables you to set new size options. ```javascript $('#grid').jqxGrid({ pagesizeoptions: ['10', '20', '30']}); ``` The 'pagesize' property sets the default page size when the paging functionality is enabled. By default the Grid displays 10 rows in a page. The 'pagerrenderer' property allows you to customize the UI of the Grid pager. In the sample below, we create a pagerrenderer function and inside the function, we build a DIV element with anchor tags. Each anchor tag has a page number as text. When the user clicks an anchor tag, the Grid calls the 'gotopage' function to navigate to a page. The 'pagerrenderer' function returns the DIV element as a result. This element is then internally appended to the Grid's pager area. #### Grid with custom Paging ```html This example illustrates how to customize the Grid plugin's Pager.
``` #### The result of the above code is: To navigate to a page with the Grid API, use the 'gotopage' function. ```javascript $("#jqxgrid").jqxGrid('gotopage', 1); ``` The 'gotoprevpage' function navigates with 1 page before the current page. The 'gotonextpage' function navigates with 1 page after the current page. For Server-Side paging, see the [Server-side processing with PHP and MySQL help topic](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-php-server-side-processing.htm). --- ### Grid Rows Grouping Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-grouping.htm > The Grid plugin supports data grouping against one or more columns. Grouping is allowed if the 'groupable' property is set to true and there's a reference to… **(requires jqxgrid.grouping.js)** The Grid plugin supports data grouping against one or more columns. Grouping is allowed if the 'groupable' property is set to true and there's a reference to the jqxgrid.grouping.js file. End-users can group data by dragging column headers to the Group Panel. This panel's visibility is controlled by the showgroupsheader property. The code example below initializes a Grid with one grouping column. ```javascript $("#jqxgrid").jqxGrid( { source: source, columns: [ { text: 'Ship Name', datafield: 'ShipName', width: 250 }, { text: 'Ship City', datafield: 'ShipCity', width: 100 }, { text: 'Ship Country', datafield: 'ShipCountry' } ], groupable: true, groups: ['ShipCity'] }); ``` #### Basic Grid with Grouping ```html This example illustrates how to enable the jQuery Grid Grouping functionality.
``` #### The result of the above code is: To hide the grouping panel, set the 'showgroupsheader' property to **false**. ```javascript $("#jqxgrid").jqxGrid('showgroupsheader', false); ``` The 'addgroup', 'insertgroup', 'removegroup' and 'removegroupat' functions enable groups manipulation with the Grid API. ```javascript $("#jqxgrid").jqxGrid('addgroup', 'lastname'); ``` *The functions should be called after the Grid data is loaded. When the data is loaded and the Grid is ready, the 'bindingcomplete' event is raised. The 'closeablegroups' property enables or disables the close buttons displayed in each group header. ```javascript $("#jqxgrid").jqxGrid('closeablegroups', false); ``` The 'expandgroup' and 'collapsegroup' functions expand or collapse a group at a specific index. The code below expands the second group: ```javascript $("#jqxgrid").jqxGrid('expandgroup', 1); ``` The 'expandallgroups' and 'collapseallgroups' functions expand or collapse all groups in the Grid. ```javascript $("#jqxgrid").jqxGrid('expandallgroups'); ``` When a group is expanded or collapsed, the 'groupexpand' or 'groupcollapse' event is raised. ```javascript $("#jqxgrid").on('groupexpand', function (event) { const args = event.args; const group = args.group; const level = args.level; }); ``` The 'groupsexpandedbydefault' Boolean property specifies the default state of the groups when displayed in the Grid. By default all groups are collapsed. --- ### Grid Localization Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-localization.htm > The Grid plugin can localize all the displayed strings by passing a localization object to the 'localizestrings' function. The Grid plugin can localize all the displayed strings by passing a localization object to the 'localizestrings' function. ```javascript const localizationobj = {}; localizationobj.pagergotopagestring = "Gehe zu:"; localizationobj.pagershowrowsstring = "Zeige Zeile:"; localizationobj.pagerrangestring = " von "; localizationobj.pagernextbuttonstring = "voriger"; localizationobj.pagerpreviousbuttonstring = "nächster"; localizationobj.sortascendingstring = "Sortiere aufsteigend"; localizationobj.sortdescendingstring = "Sortiere absteigend"; localizationobj.sortremovestring = "Entferne Sortierung"; // apply localization. $("#jqxgrid").jqxGrid('localizestrings', localizationobj); ``` #### Grid Localization Sample ```html Grid with localization.
``` --- ### Grid Cells Rendering Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cellsrendering.htm > The Grid plugin allows custom cells rendering by providing a rendering function to a grid column. The Grid plugin allows custom cells rendering by providing a rendering function to a grid column. In the sample below, the "cellsrendering" function is applied to the "Quantity" and "Unit Price" columns. The function returns a html string which is applied to the Grid cells. The Grid passes several parameters to the function providing the row index, column, cell value, default html string and additional properties of the rendering column such as column width, cells alignment and cells format. #### Grid Cells Rendering Sample ```html Grid with custom cells rendering.
``` #### The result of the above code is: You can also use the custom cells rendering feature to center the text in the Grid cells and columns. #### Grid Cells with Custom Alignment ```html This example shows how to change the Center the Grid Columns and Cells.
``` --- ### Grid Cells Formatting Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cellsformatting.htm > jQuery Grid: the cellsformat property can be used for applying a formatting to the cell values. The cellsformat property can be used for applying a formatting to the cell values. In the code example below is illustrated how to apply a custom formatting to a column with Date values and to a column with Numeric values. ```javascript $("#jqxgrid").jqxGrid( { source: source, columns: [ { text: 'Ship Name', datafield: 'ShipName', width: 250 }, { text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' }, { text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' }, { text: 'Ship Address', datafield: 'ShipAddress', width: 350 }, { text: 'Ship City', datafield: 'ShipCity', width: 100 }, { text: 'Ship Country', datafield: 'ShipCountry', width: 101 } ] }); ``` Number format strings: "d" - decimal numbers. "f" - floating-point numbers. "n" - integer numbers. "c" - currency numbers. "p" - percentage numbers. For adding decimal places to the numbers, add a number after the formatting string. For example: "c3" displays a number in this format $25.256 Built-in Date formats: // short date pattern // long date pattern "D" - "dddd, MMMM dd, yyyy", // short time pattern // long time pattern // long date, short time pattern "f" - "dddd, MMMM dd, yyyy h:mm tt", // long date, long time pattern "F" - "dddd, MMMM dd, yyyy h:mm:ss tt", // month/day pattern // month/year pattern // S is a sortable format that does not vary by culture "S" - "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss" Date format strings: "d"-the day of the month; "dd"-the day of the month; "ddd"-the abbreviated name of the day of the week; "dddd"- the full name of the day of the week; "h"-the hour, using a 12-hour clock from 1 to 12; "hh"-the hour, using a 12-hour clock from 01 to 12; "H"-the hour, using a 24-hour clock from 0 to 23; "HH"- the hour, using a 24-hour clock from 00 to 23; "m"-the minute, from 0 through 59; "mm"-the minutes,from 00 though59; "M"- the month, from 1 through 12; "MM"- the month, from 01 through 12; "MMM"-the abbreviated name of the month; "MMMM"-the full name of the month; "s"-the second, from 0 through 59; "ss"-the second, from 00 through 59; "t"- the first character of the AM/PM designator; "tt"-the AM/PM designator; "y"- the year, from 0 to 99; "yy"- the year, from 00 to 99; "yyy"-the year, with a minimum of three digits; "yyyy"-the year as a four-digit number; "yyyyy"-the year as a four-digit number. #### Grid Cells Formatting Sample ```html Grid with cells formatting
``` --- ### Grid Cells Editing Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cells-editing.htm > jqxGrid Cell Editing feature much resembles the data entering experience in an Excel Spreadsheet – once you select a grid cell, you can enter data when you… **(requires jqxgrid.edit.js)** jqxGrid Cell Editing feature much resembles the data entering experience in an Excel Spreadsheet – once you select a grid cell, you can enter data when you start typing text. In order to use the Cells Editing feature, you need to reference the jqxgrid.edit.js in your project and also to include the javascript files required by some of the editors. The Grid's 'editable' property specifies whether the editing is enabled or not. #### Mouse Edit Actions - Single mouse click: Marks the clicked cell as selected and shows the editor. The editor’s value is equal to the cell’s value. - Single mouse click on a selected cell: Marks the cell as selected and shows the editor. - Double mouse click on a cell: Marks the cell as selected and shows the editor. The editor’s value is equal to the cell’s value.. #### Keyboard Edit Actions and Navigation If the user starts typing text, the cell’s content is replaced with the text entered from the user. - Left Arrow key is pressed - Selects the left cell, when the Grid is not in edit mode. Otherwise, the key stroke is handled by the editor. - Right Arrow key is pressed - Selects the right cell, when the Grid is not in edit mode. Otherwise, the key stroke is handled by the editor. - Up Arrow key is pressed - Selects the cell above, when the Grid is not in edit mode. Otherwise, the key stroke is handled by the editor. - Down Arrow key is pressed - Selects the cell below, when the Grid is not in edit mode. Otherwise, the key stroke is handled by the editor. - Page Up/Down is pressed - Navigate Up or Down with one page, when the Grid is not in edit mode. Otherwise, the key stroke is handled by the editor. - Home/End is pressed - Navigate to the first or last row, when the Grid is not in edit mode. Otherwise, the key stroke is handled by the editor. - Enter key is pressed - Shows the selected cell’s editor. If the cell is in edit mode, hides the cell’s editor and saves the new value. The editor’s value is equal to the cell’s value. - Esc key is pressed - Hides the cell’s editor and cancels the changes. - Tab key is pressed - Selects the right cell. If the Grid is in edit mode, saves the edit cell's value, closes its editor, selects the right cell and opens its editor. - Shift+Tab keys are pressed - Selects the left cell. If the Grid is in edit mode, saves the edit cell's value, closes its editor, selects the left cell and opens its editor. - F2 key is pressed - shows the selected cell's editor. - Space key is pressed - Toggles the checkbox editor’s check state when the selected cell’s column is a checkbox column. #### Programmatic Editing The Grid have APIs for showing and hiding the cell editors. The 'begincelledit' method allows you to put a specific cell into edit mode. The 'endcelledit' method ends the edit operation and confirms or cancels the changes. The following code cancels the changes. The following code confirms the changes. To set a new value to a Grid cell, you can use the 'setcellvalue' method: To get the value of a Grid cell, you can use the 'getcellvalue' method: The 'cellbeginedit' and 'cellendedit' events are raised when the edit operation begins or ends. #### Editor Types jqxGrid supports the following types of editors: - TextBox - CheckBox(uses the jqxCheckBox widget) - NumberInput(uses the jqxNumberInput widget and edits currency, percentage and any type of numeric information) - DateTimeInput(uses the jqxDateTimeInput widget and edits date and time values) - DropDownList(uses the jqxDropDownList widget and selects a single value from a list of values) To specify the column's editor, you should set the column's 'columntype' property to 'textbox', 'dropdownlist', 'numberinput', 'checkbox' or 'datetimeinput'. To disable the editing of a specific grid column, you can set the column's editable property to false. The 'initeditor' function is called when the editor's widget is initialized. It allows you to use the properties of the widget and make it best fit your application's scenario. Please note that in order to use the 'dropdownlist', 'numberinput', 'checkbox' or 'datetimeinput' editors you need to include the necessary javascript files. #### Validation The Grid will display a validation popup message when the new cell’s value is not valid. The developers are able to set a custom validation logic and error messages for each grid column. The Grid will stay in edit mode until a correct value is entered or the user presses the “Esc” key. In following code, the "Ship Date", "Quantity" and "Price" columns define custom validation functions. Each function has 2 parameters - the edit cell and its value. Depending on your logic, you can validate the value and return true if the value is correct or false, if the value is not correct. You can also return an object with 2 members - result and message. The message member represents the message that your users will see, if the validation fails. For Server-Side cells editing, see the [Server-side processing with PHP and MySQL help topic](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-php-server-side-processing.htm). --- ### Grid Cells and Rows Selection Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cells-selection.htm > jqxGrid supports 10 selection modes - 'none', 'singlerow', 'multiplerows', 'multiplerowsextended', 'multiplerowsadvanced', 'singlecell', multiplecells'… **(requires jqxgrid.selection.js)** jqxGrid supports 10 selection modes - 'none', 'singlerow', 'multiplerows', 'multiplerowsextended', 'multiplerowsadvanced', 'singlecell', multiplecells', 'multiplecellsextended', 'multiplecellsadvanced' and 'checkbox' The cells and rows selection is implemented in the jqxgrid.selection.js. The default selection mode is set to 'singlerow'. In order to change the selection mode, you need to set the Grid's 'selectionmode' property. - none - disables the selection - singlerow - allows you to select only one row via a mouse click on a grid row or by using the keyboard arrow keys, page up/down, home and end keys. - multiplerows - this selection mode allows you to select multiple rows via a mouse click. Clicking an already selected row will unselect it. - multiplerowsextended - this selection mode allows you to select multiple rows via a drag and drop. The selection behavior resembles the selection of icons on your desktop. - multiplerowsadvanced - this selection mode allows you to select multiple rows by holding Shift or Ctrl keys while clicking on Grid rows. - checkbox - this selection mode allows you to select multiple rows by clicking checkboxes. - singlecell - allows you to select only one cell via a mouse click on a grid cell or by using the keyboard arrow keys, page up/down, home and end keys. - multiplerows - this selection mode allows you to select multiple cells via a mouse click. Clicking an already selected cell will unselect it. - multiplecellsextended - this selection mode allows you to select multiple cells via a drag and drop. The selection behavior resembles the selection of icons on your desktop. - multiplecellsadvanced - this selection mode allows you to select multiple cells via a drag and drop. The selection behavior resembles the selection in MS Excel. The following code sets the Grid's 'selectionmode': ```javascript $("#jqxgrid").jqxGrid({selectionmode: 'multiplecellsextended'}); Rows Selection API - when the selection mode is set to 'singlerow', 'multiplerows', 'checkbox', 'multiplerowsadvanced' or 'multiplerowsextended'. - selectrow, unselectrow, getselectedrowindex and getselectedrowindexes. The rowselect and rowunselect events are raised when the user selects or unselects a row. The following code will select the tenth row: // @param Number. The row index. $('#grid').jqxGrid('selectrow', 10); To unselect it, use the code below: // @param Number. The row index. $('#grid').jqxGrid('unselectrow', 10); The following code shows how to subscribe to the 'rowselect' and 'rowunselect' events: $("#jqxgrid").bind('rowselect', function (event) { var selectedRowIndex = event.args.rowindex; }); $("#jqxgrid").bind('rowunselect', function (event) { var unselectedRowIndex = event.args.rowindex; }); Cells Selection API - when the selection mode is set to 'singlecell', 'multiplecells', 'multiplecellsadvanced' or 'multiplecellsextended'. - selectcell, unselectcell, getselectedcell and getselectedcells. The cellselect and cellunselect events are raised when the user selects or unselects a cell. The following code will select a cell which is in the tenth row and in a column with 'firstname' datafield. // @param Number. The row index. // @param String. The column datafield. $('#grid').jqxGrid('selectcell', 10, 'firstname'); To unselect a cell, use the code below: // @param Number. The row index. // @param String. The column datafield. $('#grid').jqxGrid('unselectcell', 10, 'firstname'); The following code shows how to subscribe to the 'cellselect' and 'cellunselect' events: $("#jqxgrid").on('cellselect', function (event) { var datafield = event.args.datafield; var row = event.args.rowindex; var columntext = $("#jqxgrid").jqxGrid('getcolumn', event.args.datafield).text; }); $("#jqxgrid").on('cellunselect', function (event) { var datafield = event.args.datafield; var row = event.args.rowindex; var columntext = $("#jqxgrid").jqxGrid('getcolumn', event.args.datafield).text; }); The 'clearselection' method allows you to clear the selection - removes the selection in all selected rows and cells. $("#jqxgrid").jqxGrid('clearselection'); Keyboard Navigation Left Arrow key is pressed - selects the left cell Right Arrow key is pressed - selects the right cell Up Arrow key is pressed - selects the cell above Down Arrow key is pressed - selects the cell below Page Up/Down key is pressed - navigates one page up or down Home/End key is pressed - navigates to the first or last Grid row Tab key is pressed - selects the right cell Shift+Tab keys are pressed - selects the left cell The keyboard navigation is enabled by default. However, if you want to disable it, you need to set the 'keyboardnavigation' property to false. The following code disables the keyboard navigation: $("#jqxgrid").jqxGrid({keyboardnavigation: false}); ``` --- ### JSONP for a cross domain data source Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-jsonp-data-source.htm > jQuery Grid: the same-origin policy prevents a script loaded from one domain from getting or manipulating properties of a document from another domain. The same-origin policy prevents a script loaded from one domain from getting or manipulating properties of a document from another domain. That is, the domain of the requested URL must be the same as the domain of the current Web page. This basically means that the browser isolates content from different origins to guard them against manipulation. JSONP (JSON with Padding) represents a JSON data wrapped in a function call. JSONP is an older way around this. Today, a server allows cross-origin requests with CORS, and you load its data with datatype 'json'; use JSONP only for a service that offers nothing else. In this help article, we will show you how to bind the jQuery Grid to JSONP data. We will use the Geonames JSONP Service to populate our Grid with data. 1. Add references to the javascript and css files. 2. Add a DIV tag to the document’s body. We will later select this DIV tag to render the Grid inside. 3. Create the source object and a new instance of the jqxDataAdapter plug-in. In the source object, set the "url" to point to the JSONP service. The members and their values defined in the data object will be sent to the server. The "datatype" member should be set to ‘jsonp’ and we also specify the datafields array. Each datafield name is a name of a member in the data source. The jqxDataAdapter's "formatData" callback function is called when the Grid is preparing to send a new Ajax request to the server. The result of that function determines the parameters sent to the server. 4. The final step is to initialize the Grid. We achieve this by selecting the jqxgrid DIV tag and calling the jqxGrid constructor. In the constructor, we set the source property to point to the source object. We also initialize the Grid columns by setting the displayed text, datafield which points to a datafield in the source object and the column’s width. #### Working Example Below is the example's full source code: ```html In this example the Grid is bound to a Remote Data.
``` --- ### Add extra HTTP variables Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-extra-http-variables.htm > This help article illustrates how to send data to the server. The Grid builds a Data object to be sent to the server which contains data about the Grid's… This help article illustrates how to send data to the server. The Grid builds a Data object to be sent to the server which contains data about the Grid's current page number, sort columns, sort order, etc. You can also add your custom data to be sent. The data object is automatically converted to a query string by jQuery and it is appended to the url. In the following example code, we define a data object with three members. The members and their values defined in the data object will be sent to the server. The data is converted into a query string using jQuery.param() before it is sent. The above code is appropriate for static data sent to the server. By default, the Grid sends the following data to the server: - sortdatafield - the sort column's datafield. - sortorder - the sort order - 'asc', 'desc' or '' - pagenum - the current page's number when the paging feature is enabled. - pagesize - the page's size which represents the number of rows displayed in the view. - recordstartindex - the index in the view's first visible record. - recordendindex - the index in the view's last visible record - groupscount - the number of groups in the Grid - group - the group's name. The group's name for the first group is 'group0', for the second group is 'group1' and so on. - filterscount - the number of filters applied to the Grid - filtervalue - the filter's value. The filtervalue name for the first filter is "filtervalue0", for the second filter is "filtervalue1" and so on. - filtercondition - the filter's condition. The condition can be any of these: "CONTAINS", "DOES_NOT_CONTAIN", "EQUAL", "EQUAL_CASE_SENSITIVE", NOT_EQUAL","GREATER_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN", "LESS_THAN_OR_EQUAL", "STARTS_WITH", "STARTS_WITH_CASE_SENSITIVE", "ENDS_WITH", "ENDS_WITH_CASE_SENSITIVE", "NULL", "NOT_NULL", "EMPTY", "NOT_EMPTY" - filterdatafield - the filter column's datafield - filteroperator - the filter's operator - 0 for "AND" and 1 for "OR" Before the data is sent to the server, you can use the 'formatData' function of the jqxDataAdapter. The result that the 'formatData' function returns determines the parameters which will be sent to the server. The 'formatData' function is appropriate for scenarios with dynamic parameters. Here's how to override the data object and send the "my data" string to the server: The parameter passed to the 'formatData' function represents the data object which includes all settings defined by you in the source object's data member and all settings by the Grid('sortdatafield', 'sortorder', etc.). #### Sending data to the server when using the jqxGrid with PHP jQuery will automatically convert the data object into a string and send in the following format: "pagenum=0&pagesize=10&featureClass=P&style=full&maxRows=50" Then, in your PHP code, you can get the values of the pagenum and pagesize by using this code: #### Sending data to the server when using the jqxGrid with ASP .NET ASP.NET AJAX script services and page methods understand and expect input parameters to be serialized as JSON strings. These parameters are parsed out of the POST data and used as arguments to the method you’ve called. However, as the Grid provides a JSON object as a data parameter for an $.ajax call, jQuery will convert the object into a query string using jQuery.param(). Take this sample request, for example where data is defined as {featureClass: "P", style: "full", maxRows: 50};: jQuery will automatically convert the object into a string and send it as: "featureClass=P&style=full&maxRows=50". This is OK, if you are using the Grid with PHP, but in ASP.NET, the server will respond with "Invalid JSON primitive" error. The solution in ASP.NET application scenarios is to make sure that you’re passing a string for the data parameter, like this: With jqxGrid, the above data string can be achieved exactly by using the 'formatData' function. To make a GET, we need to set the data object as follows: "{}". --- ### jQuery Grid Styling and Appearance Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-styling-and-appearance.htm > Style the jQuery Grid: the jqxGrid CSS classes, the theme stylesheets it uses and how to change its appearance. jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file. Below is the list of CSS classes used by jqxGrid. - jqxGrid Style - jqx-widget - applied to the Grid widget. - jqx-grid - applied to Grid container DIV element. - jqx-grid-pager - applied to the Grid Pager. - jqx-grid-header- applied to Grid Columns container element. - jqx-grid-column-header - applied to a Grid column. - jqx-widget-header - applied to a Grid column, Toolbar, Statusbar and Groups Header. - jqx-widget-content - applied to the Grid's content area. - jqx-grid-content - applied to the Grid's content area. - jqx-grid-toolbar - applied to the toolbar. - jqx-grid-statusbar - applied to the statusbar. - jqx-grid-column-menubutton - applied to a column's menu button. - jqx-grid-column-sortascbutton - applied to a column's sort button when the sort order is ascending. - jqx-grid-column-sortdescbutton - applied to a column's sort button when the sort order is descending. - jqx-grid-column-filterbutton - applied to a column's filter button. - jqx-grid-sortasc-icon - applied to the sort ascending menu item in the Grid's Context Menu. - jqx-grid-sortdesc-icon - applied to the sort descending menu item in the Grid's Context Menu. - jqx-grid-sortremove-icon - applied to the sort remove menu item in the Grid's Context Menu. - jqx-grid-groupby-icon - applied to the 'group by' menu item in the Grid's Context Menu. - jqx-grid-groups-header - applied to the Grouping Panel area. - jqx-grid-group-column - applied to the grouping columns in the Grouping Panel. - jqx-grid-cell - applied to the grid cells. - jqx-grid-cell-sort - applied to the grid cells in the sort column. - jqx-grid-cell-filter - applied to the grid cells in the filter column. - jqx-grid-group-cell - applied to the cells in a grouping row. - jqx-grid-details-cell - applied to the cells in a details row. - jqx-grid-cell-alt - alternating cells style. This is applied to the cells in the alternating rows. - jqx-grid-cell-pinned - applied to the cells in a pinned column. - jqx-grid-cell-selected - applied to a selected cell.. - jqx-fill-state-pressed - applied to a selected cell. - jqx-grid-cell-hover - applied to a hovered. - jqx-fill-state-hover - applied to a hovered cell. - jqx-grid-group-collapse - applied to the collapse button of a grouping row. - jqx-grid-group-collapse-rtl - applied to the collapse button of a grouping row when "rtl" is enabled. - jqx-grid-group-expand - applied to the expand button of a grouping row. - jqx-grid-group-expand-rtl - applied to the expand button of a grouping row when "rtl" is enabled. - jqx-grid-column-resizeline - applied to the column's resize line. - jqx-grid-column-resizestartline - applied to the column's resize start line. - jqx-fill-state-disabled - applied to the widget when it is disabled. - jqx-grid-group-drag-line - applied to the drop line indicators displayed in the grouping header. - jqx-grid-group-column-line - applied to the lines between the group columns. When you create a custom style with colors and backgrounds for jqxGrid, you need to do the following: - Add the above CSS classes related to jqxButtons - After each CSS class, add your theme name. For example: jqx-grid-energyblue - To apply your custom style to the Grid, you need to set its 'theme' property(option) to point to your theme name string. - The sample below demonstrates how to set the 'Energy Blue' theme to the Grid. ```html GridView Styling Sample
``` --- ### jQuery Grid API Reference Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm · Full reference: https://www.jqwidgets.com/jquery-widgets-documentation/llms/jqxgrid.txt #### Properties - `altrows` (Type: Boolean, Default: false): Enables or disables the alternating rows. - `altstart` (Type: Number, Default: 1): This property specifies the first alternating row. - `altstep` (Type: Number, Default: 1): Sets or gets the alternating step - `autoshowloadelement` (Type: Boolean, Default: true): Determines whether the loading image should be displayed until the Grid's data is loaded. - `autoshowfiltericon` (Type: Boolean, Default: true): (requires jqxgrid.filter.js) - `autoshowcolumnsmenubutton` (Type: Boolean, Default: true): (requires jqxmenu.js) - `showcolumnlines` (Type: Boolean, Default: true): Sets or gets whether the columns lines are displayed. - `showrowlines` (Type: Boolean, Default: true): Sets or gets whether the row lines are displayed. - `showcolumnheaderlines` (Type: Boolean, Default: true): Sets or gets whether the column header lines are displayed. - `adaptive` (Type: boolean, Default: false): Sets or gets whether adaptive mode is enabled. - `adaptivewidth` (Type: number, Default: 600): Sets or gets the Grid's breakpoint width when adaptive mode is activated. - `compact` (Type: boolean, Default: false): Sets or gets whether compact mode is enabled. - `contextmenuitems` (Type: Array, Default: []): Sets or gets whether context menu items are set. - `contextmenuenabled` (Type: Array, Default: []): Sets or gets whether context menu is enabled. - `contextmenuwidth` (Type: Array, Default: []): Sets or gets whether context menu width is set. - `contextmenuheight` (Type: Array, Default: []): Sets or gets whether context menu height is set. - `contextmenuitemclick` (Type: Array, Default: []): Sets or gets whether contextmenuitemclick is set. - `commandcolumn` (Type: boolean, Default: false): Sets or gets whether command column is enabled. - `commandcolumnrenderer` (Type: Function): Sets a custom command column rendering function - `clipboard` (Type: Boolean, Default: true): Enables or disables the clipboard operations - `closeablegroups` (Type: Boolean, Default: true): (requires jqxgrid.grouping.js) - `columnsmenuwidth` (Type: Number, Default: 15): (requires jqxmenu.js) - `columnmenuopening` (Type: Function, Default: null): Callback called when a column menu is opening. You can use it for changing the size of the menu or cancelling the opening. Three params are passed - menu, datafield and menu's height. - `columnmenuclosing` (Type: Function, Default: null): Callback called when a column menu is closing. Three params are passed - menu, datafield and menu's height. If you return false, the closing will be cancelled. - `cellhover` (Type: Function, Default: null): Callback called when a cell is hovered. - `enablekeyboarddelete` (Type: Boolean, Default: true): Enables or disables the delete of a cell/row values by using the "delete" key. The property has effect when `editable` property is set to true, a row or cell is selected and the user presses the Del key. - `enableellipsis` (Type: Boolean, Default: true): Determines whether ellipsis will be displayed, if the cells or columns content overflows. - `enablemousewheel` (Type: Boolean, Default: true): Determines whether mousewheel scrolling is enabled. - `enableanimations` (Type: Boolean, Default: true): Enables or disables the grid animations. - `enabletooltips` (Type: Boolean, Default: false): Enables or disables the grid tooltips. - `enablehover` (Type: Boolean, Default: true): Enables or disables the grid rows hover state. - `enablebrowserselection` (Type: Boolean, Default: false): Enables the text selection of the browser. - `everpresentrowposition` (Type: String, Default: 'top'): Sets the position of the ever present row. Possible values: "top", "bottom", "topAboveFilterRow". - `everpresentrowheight` (Type: Number, Default: 30): Sets the height of the ever present row. - `everpresentrowactions` (Type: String, Default: "add reset"): Sets the actions of the ever present row. Possible values: "add", "reset", "update", "delete". Instead of "add", you can also use "addBottom" which is the same as "add", but adds the new row to the bottom of the Grid. - `everpresentrowactionsmode` (Type: String, Default: "popup"): Sets the actions display mode. By default they are displayed in a popup. - `filterrowheight` (Type: Number, Default: 31): Sets or gets the filter row's height. - `filtermode` (Type: String, Default: "default"): (requires jqxgrid.filter.js) - `groupsrenderer` (Type: function, Default: null): (requires jqxgrid.grouping.js) - `groupcolumnrenderer` (Type: function, Default: null): (requires jqxgrid.grouping.js) - `groupsexpandedbydefault` (Type: Boolean, Default: false): (requires jqxgrid.grouping.js) - `handlekeyboardnavigation` (Type: function, Default: null): The function is called when a key is pressed. If the result of the function is true, the default keyboard navigation will be overridden for the pressed key. - `pagerrenderer` (Type: function, Default: null): (requires jqxgrid.pager.js) - `rtl` (Type: Boolean, Default: false): Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts. - `showdefaultloadelement` (Type: Boolean, Default: true): Determines whether the Grid should display the built-in loading element or should use a DIV tag with class 'jqx-grid-load' - `showfiltercolumnbackground` (Type: Boolean, Default: true): (requires jqxgrid.filter.js) - `showfiltermenuitems` (Type: Boolean, Default: true): (requires jqxgrid.filter.js) - `showpinnedcolumnbackground` (Type: Boolean, Default: true): When this property is true, the Grid adds an additional visual style to the grid cells in the pinned column(s). - `showsortcolumnbackground` (Type: Boolean, Default: true): (requires jqxgrid.sort.js) - `showsortmenuitems` (Type: Boolean, Default: true): (requires jqxgrid.sort.js) - `showgroupmenuitems` (Type: Boolean, Default: true): (requires jqxgrid.grouping.js) - `showrowdetailscolumn` (Type: Boolean, Default: true): Shows an additional column with expand/collapse toggle buttons when the Row details feature is enabled. - `showheader` (Type: Boolean, Default: true): Shows or hides the columns header. - `showgroupsheader` (Type: Boolean, Default: true): (requires jqxgrid.grouping.js) - `showaggregates` (Type: Boolean, Default: false): (requires jqxgrid.aggregates.js) - `showgroupaggregates` (Type: Boolean, Default: false): (requires jqxgrid.aggregates.js and jqxgrid.grouping.js) - `showeverpresentrow` (Type: Boolean, Default: false): Shows or hides an additional row in jqxGrid which allows you to easily add new rows. - `showfilterrow` (Type: Boolean, Default: false): (requires jqxgrid.filter.js) - `showemptyrow` (Type: Boolean, Default: true): Shows or hides the empty row label when the Grid has no records to display. - `showstatusbar` (Type: Boolean, Default: false): Shows or hides the grid's statusbar. - `statusbarheight` (Type: Number, Default: 34): Sets the statusbar's height. - `showtoolbar` (Type: Boolean, Default: false): Shows or hides the grid's toolbar. - `showfilterbar` (Type: Boolean, Default: false): Shows or hides the grid's filter bar. - `filterbarmode` (Type: String, Default: default): Determines the filter bar mode - 'simple' or 'default'. - `selectionmode` (Type: String, Default: 'singlerow'): (requires jqxgrid.selection.js) - `updatefilterconditions` (Type: Function, Default: null): Sets or gets the `updatefilterconditions` property. - `updatefilterpanel` (Type: Function, Default: null): Sets or gets the `updatefilterpanel` property. - `theme` (Type: String, Default: ''): Sets the widget's theme. - `toolbarheight` (Type: Number, Default: 34): Sets or gets the toolbar's height. - `autoheight` (Type: Boolean, Default: false): Sets or gets the height of the grid to be equal to the summary height of the grid rows. This option should be set when the Grid is in paging mode. - `autorowheight` (Type: Boolean, Default: false): This property works along with the "autoheight" property. When it is set to true, the height of the Grid rows is dynamically changed depending on the cell values. - `columnsheight` (Type: Number, Default: 32): Sets or gets the columns height. - `deferreddatafields` (Type: Array, Default: []): Determines the cell values displayed in a tooltip next to the scrollbar when the "scrollmode" is set to "deferred". - `groupsheaderheight` (Type: Number/String, Default: 34): (requires jqxgrid.grouping.js) - `groupindentwidth` (Type: Number, Default: 20): (requires jqxgrid.grouping.js) - `height` (Type: Number/String, Default: 400): Sets or gets the Grid's height. - `pagerheight` (Type: Number/String, Default: 40): (requires jqxgrid.pager.js) - `rowsheight` (Type: Number, Default: 32): Sets or gets the height of the grid rows. - `scrollbarsize` (Type: Number, Default: 15): Sets or gets the scrollbars size. - `scrollmode` (Type: String, Default: "default"): Determines the scrolling mode. - `scrollfeedback` (Type: function, Default: null) - `width` (Type: Number/String, Default: 600): Sets or gets the Grid's width. - `autosavestate` (Type: Boolean, Default: false): (requires jqxgrid.storage.js) - `autoloadstate` (Type: Boolean, Default: false): (requires jqxgrid.storage.js) - `columns` (Type: Array, Default: []): Sets the Grid columns. - `columngroups` (Type: Array, Default: []): - parentgroup - sets the column header's parent group name. - `enableSanitize` (Type: boolean, Default: false) - `cardview` (Type: boolean, Default: false) - `cardviewcolumns` (Type: [], Default: []) - `cardheight` (Type: number, Default: 250) - `cardsize` (Type: number, Default: 3) - `columnsmenu` (Type: Boolean, Default: true): (requires jqxmenu.js) - `columnsresize` (Type: Boolean, Default: false): (requires jqxgrid.columnsresize.js) - `columnsautoresize` (Type: Boolean, Default: true): (requires jqxgrid.columnsresize.js) - `columnsreorder` (Type: Boolean, Default: false): (requires jqxgrid.columnsreorder.js) - `charting` (Type: Object, Default: null): Data visualization of Grid Data in a Chart. - `disabled` (Type: Boolean, Default: false): Enables or disables the Grid's plugin. - `editable` (Type: Boolean, Default: false): (requires jqxgrid.edit.js) - `batcheditable` (Type: Boolean, Default: false): The batcheditable property enables or disables the Grid batch editing feature. It works in combination with the editable property. - `editmode` (Type: String, Default: 'selectedcell'): (requires jqxgrid.edit.js) - `filter` (Type: Function, Default: null): (requires jqxgrid.filter.js) - `filterable` (Type: Boolean, Default: false): (requires jqxgrid.filter.js) - `filternlpinput` (Type: String): Sets a selector to INPUT component for Natural Language Processing Filtering. - `aiKey` (Type: String): Sets the ai key to the Grid. - `aiUrl` (Type: String): Sets the ai url to the Grid. - `groupable` (Type: Boolean, Default: false): (requires jqxgrid.grouping.js) - `groups` (Type: Array, Default: []): (requires jqxgrid.grouping.js) - `horizontalscrollbarstep` (Type: Number, Default: 5): Sets or gets the scrollbar's step when the user clicks the scroll arrows. - `horizontalscrollbarlargestep` (Type: Number, Default: 50): Sets or gets the scrollbar's large step. This property specifies the step with which the horizontal scrollbar's value is changed when the user clicks the area above or below the thumb. - `initrowdetails` (Type: function, Default: null): This function is called when the user expands the row details and the details are going to be rendered. - `disablerowdetails` (Type: Function, Default: null): This function is called when the user wants to disable the row details for particular rows - `keyboardnavigation` (Type: Boolean, Default: true): (requires jqxgrid.selection.js) - `localization` (Type: Object, Default: null): Localizes the Grid. - `pagesize` (Type: Number, Default: 10): (requires jqxgrid.pager.js) - `pagesizeoptions` (Type: Array, Default: ['5', '10', '20']): (requires jqxgrid.pager.js) - `pagermode` (Type: String, Default: "default"): (requires jqxgrid.pager.js) - `pagerbuttonscount` (Type: Number, Default: 5): (requires jqxgrid.pager.js) - `pageable` (Type: Boolean, Default: false): (requires jqxgrid.pager.js) - `autofill` (Type: Boolean, Default: false): Enables or disables the Grid Auto Fill feature. This feature can be used with 'multiplecellsadvanced' cell selection mode. It allows you to dynamically copy cell values. - `rowdetails` (Type: Boolean, Default: false): Enables or disables the row details. When this option is enabled, the Grid can show additional information below each grid row. - `rowdetailstemplate` (Type: Object, Default: null): Determines the template of the row details. The rowdetails field specifies the HTML used for details. The rowdetailsheight specifies the height of the details. - `ready` (Type: function, Default: null): This function is called when the grid is initialized and the binding is complete. - `rendered` (Type: function, Default: null): Callback function which is called when the jqxGrid's render function is called either internally or not. - `renderstatusbar` (Type: function, Default: null): Callback function which allows you to customize the rendering of the Grid's statusbar. - `rendertoolbar` (Type: function, Default: null): Callback function which allows you to customize the rendering of the Grid's toolbar. - `rendergridrows` (Type: function, Default: null): This is a function called when the grid is used in virtual mode. The function should return an array of rows which will be rendered by the Grid. - `sortable` (Type: Boolean, Default: false): (requires jqxgrid.sort.js) - `sortmode` (Type: string, Default: 'one'): (requires jqxgrid.sort.js) - `sortmodekey` (Type: String, Default: ''): The sortmodekey property determines the Grid can sort by multiple columns only when the property is set to Control and the control key is pressed. - `selectedrowindex` (Type: Number, Default: -1): (requires jqxgrid.selection.js) - `selectedrowindexes` (Type: Array, Default: []): (requires jqxgrid.selection.js) - `source` (Type: Object, Default: {}): (requires jqxdata.js) - `sorttogglestates` (Type: String, Default: 2): (requires jqxgrid.sort.js) - `updatedelay` (Type: Number, Default: 0): Sets or gets the rendering update delay. This could be used for deferred scrolling scenarios. - `virtualmode` (Type: Boolean, Default: false): Enables or disables the virtual data mode. - `verticalscrollbarstep` (Type: Number, Default: 5): Sets or gets the scrollbar's step when the user clicks the scroll arrows. - `verticalscrollbarlargestep` (Type: Number, Default: 400): Sets or gets the scrollbar's large step. This property specifies the step with which the vertical scrollbar's value is changed when the user clicks the area above or below the thumb. - `aiProvider`: `String` · `"anthropic"` - `aiModel`: `String` · `null` - `aiProxyUrl`: `String` · `null` - `aiHeaders`: `Object` · `null` - `aiSendRequest`: `Function` · `null` - `aiMaxRows`: `Number` · `40` - `cellTemplate`: `String | Object | Function` · `""` #### Events - `bindingcomplete`: `Event` - `columnresized`: `Event` - `columnreordered`: `Event` - `columnclick`: `Event` - `cellclick`: `Event` - `celldoubleclick`: `Event` - `cellselect`: `Event` - `cellunselect`: `Event` - `cellvaluechanged`: `Event` - `cellbeginedit`: `Event` - `cellendedit`: `Event` - `filter`: `Event` - `groupschanged`: `Event` - `groupexpand`: `Event` - `groupcollapse`: `Event` - `pagechanged`: `Event` - `pagesizechanged`: `Event` - `rowclick`: `Event` - `rowdoubleclick`: `Event` - `rowselect`: `Event` - `rowunselect`: `Event` - `rowexpand`: `Event` - `rowcollapse`: `Event` - `sort`: `Event` - `gridaiResult`: `Event` - `gridaiError`: `Event` #### Methods - `autoresizecolumns`: `Method` - `autoresizecolumn` (Type: Method): (requires jqxgrid.columnsresize.js) - `beginupdate` (Type: Method): Starts an update operation. This is appropriate when calling multiple methods or set multiple properties at once. Optional boolean parameter: suspendAllActions. - `clear` (Type: Method): Clears the Grid contents. - `createChart` (Type: Method): Creates a Chart from the Grid data. - `destroy` (Type: Method): Removes the Grid from the document and releases its resources. - `endupdate` (Type: Method): Ends the update operation. - `ensurerowvisible` (Type: Method): Scrolls to a row. The parameter is a bound index. - `focus` (Type: Method): Sets the keyboard Focus to the jqxGrid widget. - `getcolumnindex` (Type: Method): (requires jqxgrid.columnsreorder.js) - `getcolumn` (Type: Method): Gets a column by datafield value.Column's fields: - `getcolumnproperty` (Type: Method): Gets a property of a column. - `getrowid` (Type: Method): Gets the id of a row. The returned value is a 'String' or 'Number' depending on the id's type. The parameter is the row's bound index. - `getrowdata` (Type: Method): Gets the data of a row. The returned value is a JSON Object. The parameter is the row's bound index. Note: If you pass a bound index of a row which is not visible in the Grid, the method returns null. - `getrowdatabyid` (Type: Method): Gets the data of a row. The returned value is a JSON Object. The parameter is the row's id. - `getrowboundindexbyid` (Type: Method): Gets the index of a row in the array returned by the `getboundrows` method. - `getrowboundindex` (Type: Method): Gets the index of a row in the array returned by the `getboundrows` method. - `getrows` (Type: Method): Gets all rows. Returns an array of all rows loaded in the Grid. If the Grid is filtered, the returned value is an array of the filtered records. - `getboundrows` (Type: Method): Gets all rows loaded from the data source. The method returns an Array of all rows. The Grid's sorting, filtering, grouping and paging will not affect the result of this method. - `getdisplayrows` (Type: Method): Gets all rows that are currently displayed in the Grid. The method returns an Array of the displayed rows. The Grid's sorting, filtering, grouping and paging will affect the result of this method. - `getdatainformation` (Type: Method): Gets bound data information. - `getsortinformation` (Type: Method): Gets the sort information. - `getpaginginformation` (Type: Method): (requires jqxgrid.pager.js) - `hidecolumn` (Type: Method): Hides a column. - `hideloadelement` (Type: Method): Hides the data loading image. - `hiderowdetails` (Type: Method): Hides the details of a row. - `iscolumnvisible` (Type: Method): Gets whether a column is visible. Returns a boolean value. - `iscolumnpinned` (Type: Method): Gets whether a column is pinned. Returns a boolean value. - `localizestrings` (Type: Method): Localizes the grid strings. This method allows you to change the values of all Grid strings and also to change the cells formatting settings. - `pincolumn` (Type: Method): Pins the column. - `refreshdata` (Type: Method): Refreshes the data. - `refresh` (Type: Method): Repaints the Grid View. - `render` (Type: Method): Renders the Grid contents. This method completely refreshes the Grid cells, columns, layout and repaints the view. - `scrolloffset` (Type: Method): Scrolls the grid contents. - `scrollposition` (Type: Method): Returns the scrollbars position. - `showloadelement` (Type: Method): Shows the data loading image. - `showrowdetails` (Type: Method): Shows the details of a row. - `setcolumnindex` (Type: Method): (requires jqxgrid.columnsreorder.js) - `setcolumnproperty` (Type: Method): Sets a property of a column.Possible property names: 'text', 'hidden', 'hideable', 'renderer', 'cellsrenderer', 'align', 'cellsalign', 'cellsformat', 'pinned', 'contenttype', 'resizable', 'filterable', 'editable', 'cellclassname', 'classname', 'width', 'minwidth', 'maxwidth' - `showcolumn` (Type: Method): Shows a column. - `unpincolumn` (Type: Method): Unpins the column. - `updatebounddata` (Type: Method): Updates the bound data and refreshes the grid. You can pass 'filter' or 'sort' as parameter, if the update reason is change in 'filtering' or 'sorting'. - `updating` (Type: Method): Gets the updating operation state. Returns a boolean value. - `getsortcolumn`: `Method` - `removesort` (Type: Method): Removes the sorting. - `sortby` (Type: Method): Sorts the Grid data. - `addgroup`: `Method` - `cleargroups` (Type: Method): Clears all groups. - `collapsegroup` (Type: Method): Collapses a group. - `collapseallgroups` (Type: Method): Collapses all groups. - `expandallgroups` (Type: Method): Expands all groups. - `expandgroup` (Type: Method): Expands a group. - `getrootgroupscount` (Type: Method): Gets the number of root groups. - `getgroup` (Type: Method): Gets a group. The method returns an Object with details about the Group. The object has the following fields: - `insertgroup` (Type: Method): Groups by a column. - `iscolumngroupable` (Type: Method): Gets whether the user can group by a column. Returns a boolean value. - `removegroupat` (Type: Method): Removes a group at specific index. - `removegroup` (Type: Method): Removes a group. - `addfilter`: `Method` - `applyfilters` (Type: Method): Applies all filters to the Grid. - `clearfilters` (Type: Method): Clears all filters from the Grid. You can call the method with optional boolean parameter. - `getfilterinformation` (Type: Method): Gets the information about the Grid filters. The method returns an array of the applied filters. The returned information includes the filter objects and filter columns. Each filter in the Array has the following fields: - `getcolumnat` (Type: Method): Calls `getcolumnat`. - `removefilter` (Type: Method): Removes a filter from the Grid. - `refreshfilterrow` (Type: Method): Refreshes the filter row and updates the filter widgets. The filter row's widgets are synchronized with the applied filters. - `gotopage`: `Method` - `gotoprevpage` (Type: Method): Navigates to a previous page when the Grid paging is enabled i.e when the pageable property value is true. - `gotonextpage` (Type: Method): Navigates to a next page when the Grid paging is enabled i.e when the pageable property value is true. - `addrow`: `Method` - `begincelledit` (Type: Method): Shows the cell's editor. - `beginrowedit` (Type: Method): Shows the cell editors for an entire row. - `closemenu` (Type: Method): Closes a column's menu. - `deleterow` (Type: Method): Deletes a row or multiple rows. Returns a boolean value. - `endcelledit` (Type: Method): Hides the edit cell's editor and saves or cancels the changes. - `endrowedit` (Type: Method): Hides the edited row's editors and saves or cancels the changes. - `getcell` (Type: Method): Gets a cell. Returns an object with the following fields: - `getcellatposition` (Type: Method): Gets a cell at specific position. Returns an object with the following fields: - `getcelltext` (Type: Method): Gets the text of a cell. - `getcelltextbyid` (Type: Method): Gets the text of a cell. - `getcellvaluebyid` (Type: Method): Gets the value of a cell. - `getcellvalue` (Type: Method): Gets the value of a cell. - `isBindingCompleted` (Type: Method): Returns whether the binding is completed and if the result is true, this means that you can invoke methods and set properties. - `openmenu` (Type: Method): Displays a column's menu. - `setcellvalue` (Type: Method): Sets a new value to a cell. - `setcellvaluebyid` (Type: Method): Sets a new value to a cell. - `showvalidationpopup` (Type: Method): Displays a validation popup below a Grid cell. - `updaterow` (Type: Method): Updates a row or multiple rows. - `clearselection`: `Method` - `getselectedrowindex` (Type: Method): The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended' - `getselectedrowindexes` (Type: Method): The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended' - `getselectedcell` (Type: Method): The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended' - `getselectedcells` (Type: Method): The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended' - `showSidePanel` (Type: Method): Shows the Grid's side panel. Pass the element's id when you call the method. - `closeSidePanel` (Type: Method): Closes the Grid's side panel. - `selectcell` (Type: Method): The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended' - `selectallrows` (Type: Method): The selection mode should be set to: 'multiplerows' or 'multiplerowsextended' - `selectrow` (Type: Method): The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended' - `unselectrow` (Type: Method): The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended' - `unselectcell` (Type: Method): The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended' - `getcolumnaggregateddata`: `Method` - `refreshaggregates` (Type: Method): Refreshes the Aggregates in the Grid's status bar. - `renderaggregates` (Type: Method): Renders the aggregates in the Grid's status bar. - `exportdata`: `Method` - `exportview` (Type: Method): Exports all rows loaded within the Grid to Excel, XML, CSV, TSV, HTML or JSON. - `getstate`: `Method` - `loadstate` (Type: Method): Loads the Grid's state. the loadstate method loads the following information: 'sort column, sort order, page number, page size, applied filters and filter row values, column widths and visibility, cells and rows selection and groups. - `savestate` (Type: Method): Saves the Grid's current state. the savestate method saves the following information: 'sort column, sort order, page number, page size, applied filters and filter row values, column widths and visibility, cells and rows selection and groups. - `openColumnChooser` (Type: Method): Opens the column chooser of the grid which allows you to setup columns visibility. - `aiConfig`: `Method` - `aiCommand`: `Method` - `aiAsk`: `Method` - `aiSummarize`: `Method` - `aiExplainRow`: `Method` - `aiClassifyColumn`: `Method` --- ### Bind the jQuery Grid to data Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm > This tutorial shows the two ways to give jqxGrid its rows in plain JavaScript: let the grid's data adapter load a URL, or load the data yourself with fetch… This tutorial shows the two ways to give jqxGrid its rows in plain JavaScript: let the grid's data adapter load a URL, or load the data yourself with `fetch` and hand the rows to the grid. You will also add and remove rows with the grid's methods, and replace all of them with a new data set. It is the first of a series of jqxGrid tutorials for JavaScript. Each one is a single HTML page that you can save and open. None of them needs jQuery or a build step. The finished example: the product list, with buttons that add a row and remove the products not in stock. #### Before you start The examples load jQWidgets 27 from the jsDelivr CDN: the base stylesheet, a theme (`fluent` here), `jqxcore.js`, and then only the files the page uses. `jqxcore.js` provides `$`, so `$('#grid').jqxGrid({ … })` works on a page without jQuery. The pages of this tutorial load these files: ```html ``` | File | What it adds | | --- | --- | | `jqxcore.js` | The core of every widget, and `$` | | `jqxdata.js` | The data adapter, `$.jqx.dataAdapter` | | `jqxbuttons.js`, `jqxscrollbar.js` | The grid's scroll bars | | `jqxcheckbox.js` | The checkbox column | | `jqxgrid.js`, `jqxgrid.selection.js` | The grid and its row and cell selection (needed even when the page selects nothing) | A missing file usually stops the grid with an error that names it, such as *jqxGrid: Missing reference to jqxscrollbar.js*. Two do not: without `jqxcheckbox.js` the checkbox column stays empty, and without `jqxdatetimeinput.js` (used from the next tutorial on) the date filter is missing. The later tutorials list the files they add. To install from npm instead, run `npm install jqwidgets-scripts` and replace `https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/` with `node_modules/jqwidgets-scripts/` in the same tags. With a bundler such as Vite, import the library and the styles as shown on the [documentation home page](https://www.jqwidgets.com/jquery-widgets-documentation/index.htm). Open the pages through a web server, not as files: a page opened from a `file://` address cannot `fetch` other files. Any static server works. With Node.js installed, run this in the folder of the pages and open the address it prints: ```bash npx serve ``` The examples use this sample file. Save it as `products.json` next to the pages: ```json [ { "id": 1, "name": "Chai", "category": "Beverages", "price": 18, "inStock": true }, { "id": 2, "name": "Chang", "category": "Condiments", "price": 19, "inStock": true }, { "id": 3, "name": "Aniseed Syrup", "category": "Confections", "price": 10, "inStock": false }, { "id": 4, "name": "Ikura", "category": "Dairy", "price": 31, "inStock": true }, { "id": 5, "name": "Konbu", "category": "Seafood", "price": 6, "inStock": true }, { "id": 6, "name": "Tofu", "category": "Beverages", "price": 23.25, "inStock": true }, { "id": 7, "name": "Pavlova", "category": "Condiments", "price": 17.45, "inStock": false }, { "id": 8, "name": "Mascarpone", "category": "Confections", "price": 32, "inStock": true } ] ``` #### 1. Let the data adapter load a URL A `$.jqx.dataAdapter` describes where the rows come from and the type of each field. Given a `url`, it loads the rows itself when the grid asks for them. The grid is created by calling `jqxGrid` with its options on an empty element: ```javascript // The adapter loads the URL itself, when the grid asks for its data. const source = new $.jqx.dataAdapter( { url: 'products.json', datatype: 'json', id: 'id', datafields: [ { name: 'name', type: 'string' }, { name: 'category', type: 'string' }, { name: 'price', type: 'number' }, { name: 'inStock', type: 'bool' } ] }, { loadError: (xhr, status, error) => { document.getElementById('status').textContent = `Could not load the products (${status}: ${error}).`; } } ); $('#grid').jqxGrid({ theme: 'fluent', width: '100%', autoheight: true, source, columns: [ { text: 'Product', datafield: 'name', width: 220 }, { text: 'Category', datafield: 'category', width: 160 }, { text: 'Price', datafield: 'price', cellsformat: 'c2', cellsalign: 'right', align: 'right', width: 110 }, { text: 'In stock', datafield: 'inStock', columntype: 'checkbox', width: 90 } ] }); ``` The `datafields` types matter: a `number` field sorts and formats as a number (`cellsformat: 'c2'` writes it as currency), and a `bool` field fills the checkbox column. `id: 'id'` names the field that identifies a row, which methods such as `deleterow` and `getrowdatabyid` use. When the request fails, the adapter calls `loadError` with the request, a status and the error. For an HTTP error the status is `error` and the error is the status text (*Not Found*, *Internal Server Error*); for an answer that is not valid JSON the status is `parsererror`. The adapter adds the grid's state to the URL as query parameters (`pagenum`, `pagesize`, `filterscount`, and a `_` parameter that keeps the browser from answering from its cache). A static file ignores them; [server-side processing](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm) uses them. #### 2. Load the data yourself When the page needs the rows too (to count them, show them elsewhere, or change them before they are shown), load them with `fetch` and give the adapter the array as `localdata`. The page's script is a module (`

Products

``` Open it through the web server. The grid shows the eight products and the line above it reads *8 products*. *Add a product* adds *New product 9*; *Remove products not in stock* removes Aniseed Syrup and Pavlova; *Reload* loads the file again and shows its eight products. #### Next - [Sorting, filtering and paging](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-sorting-filtering-paging.htm) - [Server-side paging, sorting and filtering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm), for tables too large to load at once - [Grid data sources](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm): XML, CSV, TSV and the other formats the data adapter reads - [jQuery Grid API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm) --- ### Sorting, filtering and paging in the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-sorting-filtering-paging.htm > jqxGrid sorts, filters and pages on its own once you turn those features on. jqxGrid sorts, filters and pages on its own once you turn those features on. This tutorial goes a step further: the page reads the grid's state after each change to show a summary line, and controls the grid from its own search box and buttons. It also shows how grid events reach your code: through the `on` method of the grid's element, with the details in `event.args`. The finished example: 500 orders with sorting, a filter row and paging, and a status line the app keeps up to date. #### Before you start Set up a page as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm), which also explains the data adapter. Sorting, filtering and paging need more files than a plain grid: ```html ``` `jqxgrid.sort.js`, `jqxgrid.filter.js` and `jqxgrid.pager.js` add the three features. `jqxmenu.js` draws the column menu; `jqxlistbox.js`, `jqxdropdownlist.js` and `jqxcheckbox.js` draw the pager's page-size list and the checked-list filter; `jqxcalendar.js` and `jqxdatetimeinput.js` the date range filter. #### 1. Turn the features on `sortable` lets users sort by clicking a column header. `filterable` with `showfilterrow` adds a row of filter inputs under the headers, and each column's `filtertype` picks the input: text by default, `checkedlist` for a list of values, `number` for numbers, `range` for a date range. `pageable` adds a pager, and `pagesizeoptions` lists the page sizes a user can pick. ```javascript grid.jqxGrid({ theme: 'fluent', width: '100%', autoheight: true, source, sortable: true, filterable: true, showfilterrow: true, pageable: true, pagesize: 10, pagesizeoptions: ['10', '25', '50'], columns: [ { text: 'Customer', datafield: 'customer', width: 200 }, { text: 'Product', datafield: 'product', width: 140, filtertype: 'checkedlist' }, { text: 'Quantity', datafield: 'quantity', width: 100, cellsalign: 'right', align: 'right', filtertype: 'number' }, { text: 'Price', datafield: 'price', width: 100, cellsalign: 'right', align: 'right', cellsformat: 'c2', filtertype: 'number' }, { text: 'Date', datafield: 'date', cellsformat: 'yyyy-MM-dd', filtertype: 'range' } ] }); ``` A text filter applies when the user stops typing for a moment, or at once on Enter; the checked list applies when its drop-down closes. #### 2. Read the grid's state The grid raises `sort`, `filter`, `pagechanged` and `pagesizechanged` after each change, and `bindingcomplete` when it has bound its data. Attach handlers with the `on` method of the grid's element; one call can take several event names, separated by spaces. The page answers all of them with the same function, which asks the grid for its current state and writes a summary: ```javascript // What the grid shows now: read from the grid after it binds, sorts, filters or pages. function describe() { const paging = grid.jqxGrid('getpaginginformation'); const sort = grid.jqxGrid('getsortinformation'); const rows = grid.jqxGrid('getdatainformation').rowscount; const sorted = sort.sortcolumn ? `sorted by ${sort.sortcolumn} ${sort.sortdirection.ascending ? 'ascending' : 'descending'}` : 'not sorted'; status.textContent = `${rows} orders, page ${Number(paging.pagenum) + 1} of ${paging.pagescount}, ${sorted}`; } // Handlers attached before the grid is created also catch its first binding. grid.on('bindingcomplete sort filter pagechanged pagesizechanged', describe); ``` Three details matter here: - The handlers are attached *before* the grid is created. A grid with local data binds while it is created, so a `bindingcomplete` handler attached afterwards would miss it. - Grid events go through the library's own event system, so `$('#grid').on(…)` receives them and `addEventListener` on the same element does not. The event's details are in `event.args`. - The events report changes made by users and by methods such as `sortby` and `gotopage`. Setting an option from code, for example `$('#grid').jqxGrid({ pagesize: 25 })`, raises no event; call `describe()` yourself after it. #### 3. Control the grid from the page Any grid method can be called from the page's own controls. A search box becomes a filter on the Customer column: `removefilter` drops the previous one (its `false` argument skips a redraw), `addfilter` adds a filter group, and `applyfilters` runs them. ```javascript // A customer search box of the page's own, applied as a grid filter on one column. search.addEventListener('input', () => { const text = search.value.trim(); grid.jqxGrid('removefilter', 'customer', false); if (text) { const group = new $.jqx.filter(); group.addfilter(0, group.createfilter('stringfilter', text, 'contains')); grid.jqxGrid('addfilter', 'customer', group); } grid.jqxGrid('applyfilters'); }); ``` Sorting and paging work the same way: `sortby('quantity', 'desc')`, `gotopage(0)`, and to undo everything `clearfilters()` and `removesort()`. ```javascript document.getElementById('largest').addEventListener('click', () => { grid.jqxGrid('sortby', 'quantity', 'desc'); grid.jqxGrid('gotopage', 0); }); document.getElementById('reset').addEventListener('click', () => { search.value = ''; grid.jqxGrid('clearfilters'); grid.jqxGrid('removesort'); grid.jqxGrid('gotopage', 0); }); ``` #### The complete example ```html Orders

Orders

``` The summary starts as *500 orders, page 1 of 50, not sorted*. Type *ernst* in the search box: the grid shows the 62 orders of Ernst Handel on 7 pages. *Largest orders first* sorts them by quantity, *Reset* clears the search, the filters and the sort. The filter row works on its own too: in the Product list, clear *(Select All)* and check *Chai* to see its 63 orders. #### Next - [Editing and validation](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-editing.htm) - [Server-side paging, sorting and filtering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm) - [Export and saving the layout](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-export-state.htm): keep the sort and filters between visits - More about each feature: [sorting](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-sorting.htm), [filtering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-filtering.htm) and [paging](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-paging.htm) --- ### Editing and validation in the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-editing.htm > This tutorial makes jqxGrid editable: text, a drop-down list, a number input with validation, a date picker and a checkbox. This tutorial makes jqxGrid editable: text, a drop-down list, a number input with validation, a date picker and a checkbox. The grid keeps the edited data; the page keeps a list of what changed, shows it, and hands it to a save function. The finished example: double-click a cell to edit it; the changes are counted and saved together. #### Before you start Set up a page as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm). Editing needs `jqxgrid.edit.js`, and each editor needs its widget: `jqxlistbox.js` and `jqxdropdownlist.js` for the drop-down list, `jqxnumberinput.js` for numbers, `jqxcalendar.js` and `jqxdatetimeinput.js` for dates, `jqxcheckbox.js` for the checkbox: ```html ``` #### 1. Make the grid editable `editable` turns editing on. `editmode: 'dblclick'` starts an edit with a double click (the default is a click on a selected cell), and `selectionmode: 'singlecell'` selects cells rather than rows, which suits editing. Enter or a click elsewhere ends the edit and keeps the value; Esc cancels it. A checkbox cell changes with a single click. ```javascript grid.jqxGrid({ theme: 'fluent', width: '100%', autoheight: true, source, columns, editable: true, editmode: 'dblclick', selectionmode: 'singlecell' }); ``` #### 2. Choose an editor per column, and validate A column's `columntype` picks its editor: `dropdownlist`, `numberinput`, `datetimeinput`, `checkbox`, or a text box by default. `createeditor` runs when the editor is created and receives the editor as a `$`-wrapped element, so it can set the widget's own options, such as the list of departments. `editable: false` keeps a column read only. Two hooks check values: - `validation` receives the new value. Returning `true` accepts it; returning `{ result: false, message }` keeps the editor open with the message next to it, until the value is valid or the user cancels. The salary column uses it. - `cellvaluechanging` runs when an edit ends and returns the value to store. The name column trims the text, and returns the old value when the new one is empty, which cancels the change. ```javascript const columns = [ { text: 'Name', datafield: 'name', width: 190, // A rule that needs the value as text: checked when the edit ends. cellvaluechanging: (row, datafield, columntype, oldvalue, newvalue) => { // Returning the old value cancels the change. return String(newvalue).trim() === '' ? oldvalue : String(newvalue).trim(); } }, { text: 'Department', datafield: 'department', width: 150, columntype: 'dropdownlist', createeditor: (row, value, editor) => { editor.jqxDropDownList({ source: departments, autoDropDownHeight: true }); } }, { text: 'Salary', datafield: 'salary', width: 130, columntype: 'numberinput', cellsformat: 'c0', cellsalign: 'right', align: 'right', // The value stays in the editor and the message shows until it is valid. validation: (cell, value) => { if (value === undefined || value < 20000 || value > 300000) { return { result: false, message: 'Enter a salary between 20,000 and 300,000.' }; } return true; }, createeditor: (row, value, editor) => { editor.jqxNumberInput({ decimalDigits: 0, digits: 6, spinButtons: true }); } }, { text: 'Start date', datafield: 'startDate', width: 150, columntype: 'datetimeinput', cellsformat: 'yyyy-MM-dd' }, { text: 'Remote', datafield: 'remote', columntype: 'checkbox', width: 80 }, // Read only: the id is not editable. { text: 'Id', datafield: 'id', width: 60, editable: false } ]; ``` #### 3. Keep a list of the changes The grid raises `cellvaluechanged` after each accepted edit. Its details are in `event.args`: the row index, the field, and the old and new values. `getrowid` turns the row index into the row's id. The handler adds the change to a list and draws the list again: ```javascript // The grid keeps the edited data; the page keeps a list of what changed, for saving. const changes = []; const list = document.getElementById('changes'); const saveButton = document.getElementById('save'); const show = (value) => (value instanceof Date ? value.toLocaleDateString('en-CA') : String(value)); function renderChanges() { // textContent, not innerHTML: an edited value is shown as text, whatever it contains. list.replaceChildren(...changes.map((c) => { const item = document.createElement('li'); item.textContent = `Employee ${c.id}: ${c.field} ${show(c.oldValue)} → ${show(c.newValue)}`; return item; })); document.getElementById('changeCount').textContent = changes.length; saveButton.disabled = changes.length === 0; } grid.on('cellvaluechanged', (event) => { const { rowindex, datafield, oldvalue, newvalue } = event.args; const id = Number(grid.jqxGrid('getrowid', rowindex)); changes.push({ id, field: datafield, oldValue: oldvalue, newValue: newvalue }); renderChanges(); }); ``` The list is built from elements with `textContent`, never from HTML strings, so a value such as `Janet` appears as typed. The grid's own cells are different: they write a value into the page as HTML, also in columns without a renderer. For columns where users type text, add the escaping renderer shown in [Custom cell rendering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cell-rendering.htm). To save, `getrows` returns the grid's current rows, edits included. The example sends only the rows that changed, and clears the list once they are saved. ```javascript saveButton.addEventListener('click', () => { const changedIds = new Set(changes.map((c) => c.id)); const payload = grid.jqxGrid('getrows').filter((row) => changedIds.has(row.id)); // Send payload to your server here, for example with fetch('/api/employees', { method: 'PUT', ... }). console.log('Saving', payload); changes.length = 0; renderChanges(); }); ``` #### The complete example ```html Employees

Employees

Double-click a cell to edit it. Enter or a click outside saves the cell; Esc cancels.

Unsaved changes: 0

    ``` Double-click Nancy Davolio's salary and type 5: the message *Enter a salary between 20,000 and 300,000.* appears and the editor stays open. Type 61000 and press Enter: the cell shows $61,000 and the list reads *Employee 1: salary 58000 → 61000*. Double-click a start date, open the editor's calendar and pick a day; click a Remote checkbox. *Save changes* logs the changed rows in the browser console and empties the list. #### Next - [Selection and master-detail](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-master-details.htm) - [Custom cell rendering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cell-rendering.htm) - [Cell editing](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cells-editing.htm): every editor and edit mode - The column options in the [jQuery Grid API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm) (`columns`) --- ### Selection and master-detail with the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-master-details.htm > This tutorial connects two grids: selecting a customer in the first grid shows that customer's orders in the second, with a heading and a summary written by… This tutorial connects two grids: selecting a customer in the first grid shows that customer's orders in the second, with a heading and a summary written by the page. It is the usual shape of a master-detail screen. The finished example: selecting a customer shows their orders in a second grid. #### Before you start Set up a page as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm). Both grids are plain grids with selection, so the page needs only these files: ```html ``` #### 1. Listen for the selection With `selectionmode: 'singlerow'`, the grid raises `rowselect` when a row is selected, with the mouse or with the arrow keys. Its `event.args.row` holds the row's data and `event.args.rowindex` its index. Attach the handler with the `on` method of the grid's element: grid events do not reach `addEventListener`. ```javascript // The grid raises rowselect with the selected row's data in event.args.row. $('#customers').on('rowselect', (event) => { showOrders(event.args.row); }); ``` The master grid is not touched when the detail changes, so it keeps the selected row highlighted. #### 2. Give the detail grid the selected rows The detail grid is created once, with an empty array as its data. Its source is a settings object kept in a constant, so the page can change its rows later: ```javascript // The detail grid starts empty. Its source keeps the settings, and its rows change with // the selection. const orderSource = { localdata: [], datatype: 'array', id: 'id', datafields: [ { name: 'id', type: 'number' }, { name: 'date', type: 'date' }, { name: 'product', type: 'string' }, { name: 'quantity', type: 'number' }, { name: 'total', type: 'number' } ] }; $('#orders').jqxGrid({ theme: 'fluent', width: '100%', autoheight: true, source: new $.jqx.dataAdapter(orderSource), columns: [ { text: 'Order', datafield: 'id', width: 80 }, { text: 'Date', datafield: 'date', cellsformat: 'yyyy-MM-dd', width: 120 }, { text: 'Product', datafield: 'product', width: 140 }, { text: 'Quantity', datafield: 'quantity', cellsalign: 'right', align: 'right', width: 90 }, { text: 'Total', datafield: 'total', cellsformat: 'c2', cellsalign: 'right', align: 'right' } ] }); ``` When a customer is selected, the page puts that customer's orders in the source's `localdata` and calls `updatebounddata`, and the detail grid binds to them: ```javascript function showOrders(customer) { const own = orders.filter((o) => o.customerId === customer.id); // New rows for the detail grid: put them in its source and bind again. orderSource.localdata = own; $('#orders').jqxGrid('updatebounddata'); // textContent: the company name is shown as text, whatever it contains. document.getElementById('detailTitle').textContent = `Orders of ${customer.company}, ${customer.city}`; const sum = own.reduce((s, o) => s + o.total, 0); document.getElementById('detailSummary').textContent = `${own.length} orders, ${sum.toLocaleString('en-US', { style: 'currency', currency: 'USD' })} in total`; document.getElementById('hint').hidden = true; document.getElementById('detail').hidden = false; } ``` The detail section is hidden until the first selection. A grid created inside a hidden element lays itself out when the element is shown, so the detail grid can be created with the page. Here the orders are already in the page. With a server, give the detail source a `url` instead of `localdata`, change the URL to the selected customer's orders (for example `/api/customers/${customer.id}/orders`), and call `updatebounddata` the same way: the grid loads the new URL. #### 3. Write the rest of the page The heading and the summary are set with `textContent`, so a company name is shown as text whatever characters it contains. The total is formatted with `toLocaleString`. #### The complete example ```html Customers

    Customers

    Select a customer to see their orders.

    ``` Select *Ernst Handel*: the heading reads *Orders of Ernst Handel, Graz*, the detail grid lists ten orders and the summary reads *10 orders, $1,780.00 in total*. Press the down arrow: Frankenversand is selected and the detail follows, while the first grid keeps the selected row highlighted. #### Next - [Custom cell rendering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cell-rendering.htm) - [Grouping and aggregates](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-grouping-aggregates.htm) - [Cells selection](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cells-selection.htm): the other selection modes - The selection events and methods in the [jQuery Grid API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm) --- ### Custom cell rendering in the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-cell-rendering.htm > jQuery Grid: this tutorial changes how cells look: a coloured badge for a task's status, a progress bar, a red due date when a task is late, and a button in… This tutorial changes how cells look: a coloured badge for a task's status, a progress bar, a red due date when a task is late, and a button in each row that opens the task. It also shows how to keep text that users typed from being read as HTML, which in jqxGrid matters for plain columns too. The finished example: badges, progress bars, red dates and buttons, all drawn by the cells. #### Before you start Set up a page as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm). Renderers, cell classes and template columns are part of the grid itself, so the page loads the same files as a plain grid: ```html ``` #### 1. Escape what users typed jqxGrid writes a cell's value into the page as HTML. That is true in columns without a renderer as well: in jqwidgets-scripts 27.1.0 and earlier, a value such as `bold` in a plain text column shows in bold, and an `` with an `onerror` attribute runs its script. The grid's `enableSanitize` option stops such a script, but it escapes that value twice, so the cell shows `<img src=…` instead of what the user typed. So give every column that shows text from users a renderer that escapes it. A column's `cellsrenderer` receives the row index, the field and the value, and returns the cell's HTML: ```javascript // Cell renderers return HTML. Text that users typed goes through escapeHtml first: // the third task's title would otherwise be markup. function escapeHtml(text) { return String(text).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]); } // A cell that shows its value as text. The grid writes values into the page as HTML, // in columns without a renderer too, so every column of user text gets this renderer. const textCell = (row, field, value) => `
    ${escapeHtml(value)}
    `; ``` A renderer replaces the cell's content, including the element the grid puts around the value for alignment and padding. The `text-cell` class gives the text back its padding, and a line height equal to the grid's `rowsheight` (40 pixels here) centres it vertically. The third task has `

    Tasks

    Open a task to see it here.

    ``` The grid shows a badge for each status, a progress bar, and the due dates of late tasks in red. The third task's title reads *Fix \ ``` #### 1. Group `groupable` turns grouping on and `groups` lists the columns to group by when the grid starts. `showgroupsheader` adds a bar above the headers: drag a column header there to group by it as well, or click the × on a group to remove it. Groups start collapsed; click the arrow at the start of a group's row to open it. ```javascript grid.jqxGrid({ theme: 'fluent', width: '100%', height: 480, source, columns, groupable: true, groups: ['category'], groupsrenderer, showgroupsheader: true, showaggregates: true, showgroupaggregates: true, showstatusbar: true, statusbarheight: 70 }); ``` `groupsrenderer` writes each group's header. It receives the header's text, the group's value, whether the group is expanded, and an object with the group's rows (`subItems`) and, when the grid is grouped by more than one column, its subgroups (`subGroups`). When the grid also shows totals for each group, the total rows are in those lists too, marked `totalsrow`, so the counts leave them out. The group's value comes from the data, so it is escaped: ```javascript // The group value comes from the data, so the header escapes it. const escapeHtml = (text) => String(text).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]); // A group's header: its value and how many rows or subgroups it holds. data.subItems holds // the group's rows, and data.subGroups its subgroups when the grid is grouped by more than // one column. With showgroupaggregates, the group's total rows are in the same list, marked // totalsrow, so the counts leave them out. function groupsrenderer(text, group, expanded, data) { const rows = (data.subItems ?? []).filter((row) => !row.totalsrow).length; const groups = (data.subGroups ?? []).filter((row) => !row.totalsrow).length; return `
    ${escapeHtml(group)} (${groups ? `${groups} groups` : `${rows} sales`})
    `; } ``` #### 2. Add aggregates A column's `aggregates` lists what to compute: `sum`, `avg`, `min`, `max` and `count`, or a custom aggregate, an object whose key is its label and whose function is called for each row with the running result and the row's value. `showaggregates` with `showstatusbar` shows them for the whole table under the rows, and `showgroupaggregates` for each group, as rows at the end of the group: the first row holds each column's first aggregate, the second row the second, and so on. `aggregatesrenderer` decides how a column's totals are written in the status bar. The values it receives are already formatted with the column's `cellsformat`, so the revenue total arrives as *$57,320*. A column without a renderer shows each aggregate as its label and value (*Sum:2940*), and so do the group total rows, which do not use the renderer. ```javascript const columns = [ { text: 'Region', datafield: 'region', width: 110 }, { text: 'Category', datafield: 'category', width: 140 }, { text: 'Product', datafield: 'product', width: 160 }, { text: 'Units', datafield: 'units', width: 150, cellsalign: 'right', align: 'right', // A custom aggregate next to the built-in ones: how many sales were of 30 units or more. aggregates: [ 'sum', 'avg', { 'Large sales': (count, value) => (value >= 30 ? count + 1 : count) } ] }, { text: 'Revenue', datafield: 'revenue', cellsalign: 'right', align: 'right', cellsformat: 'c0', aggregates: ['sum', 'max'], // How the totals are written. The grid passes them already formatted with the column's // cellsformat ("$57,320"). aggregatesrenderer: (aggregates) => `
    Total ${aggregates.sum}
    Largest sale ${aggregates.max}
    ` } ]; ``` #### 3. Change the grouping from the page A select of the page's own groups by another column: `cleargroups` removes the grouping and `addgroup` adds a column to it. `expandallgroups` and `collapseallgroups` open and close every group. ```javascript // Grouping from the page's own control (the grid's header also takes drag and drop). document.getElementById('groupBy').addEventListener('change', (event) => { const field = event.target.value; grid.jqxGrid('cleargroups'); if (field) { grid.jqxGrid('addgroup', field); } }); document.getElementById('expand').addEventListener('click', () => grid.jqxGrid('expandallgroups')); document.getElementById('collapse').addEventListener('click', () => grid.jqxGrid('collapseallgroups')); ``` #### The complete example ```html Sales

    Sales

    ``` The grid opens grouped by category: *Beverages (40 sales)*, *Condiments (20 sales)*, *Seafood (40 sales)* and *Dairy (20 sales)*. The status bar shows the units (*Sum:2940*, *Avg:24.5*, *Large sales:45*) and the revenue (*Total $57,320*, *Largest sale $1,408*). Open Beverages and scroll to its end: its total rows read *Sum:980* and *Sum:$18,140*, *Avg:24.5* and *Max:$836*, *Large sales:15*. Pick *Region* to group by region instead, then drag the Category header into the bar above the grid: each region shows *(3 groups)*. #### Next - [Export and saving the layout](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-export-state.htm) - [Server-side paging, sorting and filtering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm) - [Grouping](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-grouping.htm): more about the group options --- ### Server-side paging, sorting and filtering with the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm > With server-side processing the grid asks the server for one page at a time, and the server sorts and filters before it pages. With server-side processing the grid asks the server for one page at a time, and the server sorts and filters before it pages. The browser never holds the whole table, so it works the same with ten thousand rows or ten million. This tutorial builds both halves: a grid in virtual mode, and a small Node.js API with Express that also serves the page. The finished example: 10,000 orders paged, sorted and filtered by an Express server. #### Before you start You need Node.js 22 or later. Create a project for the API and install Express. `npm pkg set type=module` lets the server use `import`: ```bash npm init -y npm install express npm pkg set type=module ``` The project has two files: `server/server.js`, the API, and `public/server-side.html`, the page. The page loads jQWidgets from the CDN, as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm), with the files for sorting, filtering and paging listed in [Sorting, filtering and paging](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-sorting-filtering-paging.htm), except `jqxcheckbox.js`, which only the checked-list filter needs. #### 1. What the grid sends In virtual mode, every page change, sort and filter becomes a request to the source's `url`, with the grid's state in the query string: | Parameter | Meaning | | --- | --- | | `pagenum`, `pagesize` | The page (from 0) and the rows per page. | | `sortdatafield`, `sortorder` | The column to sort by, and `asc` or `desc`. Absent when the grid is not sorted. | | `filterscount` | How many filters there are. | | `filterdatafield0`, `filtercondition0`, `filtervalue0`, `filteroperator0`, … | For each filter: the column, the condition (`CONTAINS`, `EQUAL`, `GREATER_THAN` and so on), the value, and how it joins the previous filter on the same column (0 = and, 1 = or). Dates arrive in the format of their data field, here `yyyy-MM-dd`; a date range is two filters on the column, `GREATER_THAN_OR_EQUAL` and `LESS_THAN_OR_EQUAL`. | The grid also sends `recordstartindex` and `recordendindex` (the same range as row numbers), `groupscount`, a `filterGroups` copy of the filters, and a `_` parameter against caching. The API below does not need them. It answers with the matching rows of the requested page and the number of matching rows, so the pager knows how many pages there are. #### 2. The API Save this as `server/server.js`. The data is generated in memory to keep the example self-contained; a real API runs the same filtering, sorting and paging in its database query. Column names and conditions are checked against lists before they are used (with `Object.hasOwn`, so a name such as `constructor` is not taken from the object's prototype), and the page size is kept in a range: nothing in a request reaches other data. ```javascript import { fileURLToPath } from 'node:url'; import express from 'express'; const app = express(); // The pages in public/ come from the same server as the API, so the grid can use a relative URL. app.use(express.static(fileURLToPath(new URL('../public', import.meta.url)))); // Sample data: 10,000 orders kept in memory. A real API runs the same paging, sorting and // filtering in its database query. const customers = ['Alfreds Futterkiste', 'Bon app', 'Ernst Handel', 'Frankenversand', 'Königlich Essen', 'Que Delícia', 'Wartian Herkku', 'Wilman Kala']; const products = ['Chai', 'Chang', 'Ikura', 'Konbu', 'Tofu', 'Pavlova', 'Gnocchi', 'Mascarpone']; const day = 24 * 60 * 60 * 1000; const orders = Array.from({ length: 10000 }, (_, i) => ({ id: i + 1, customer: customers[(i * 7) % customers.length], product: products[(i * 5) % products.length], quantity: 1 + ((i * 13) % 50), price: Math.round((2 + ((i * 37) % 45) + ((i * 11) % 100) / 100) * 100) / 100, date: new Date(Date.UTC(2026, 0, 1) + ((i * 3) % 270) * day).toISOString().slice(0, 10) })); // The columns the grid may sort and filter by. Any other field name in a request is ignored, // so a request cannot reach other data. const COLUMNS = { customer: 'string', product: 'string', quantity: 'number', price: 'number', date: 'date' }; // The conditions the grid's filters send, for each type of column. const TEST = { CONTAINS: (a, b) => String(a).toLowerCase().includes(String(b).toLowerCase()), DOES_NOT_CONTAIN: (a, b) => !String(a).toLowerCase().includes(String(b).toLowerCase()), STARTS_WITH: (a, b) => String(a).toLowerCase().startsWith(String(b).toLowerCase()), ENDS_WITH: (a, b) => String(a).toLowerCase().endsWith(String(b).toLowerCase()), EQUAL: (a, b) => (typeof a === 'string' ? a.toLowerCase() === String(b).toLowerCase() : a === b), NOT_EQUAL: (a, b) => (typeof a === 'string' ? a.toLowerCase() !== String(b).toLowerCase() : a !== b), LESS_THAN: (a, b) => a < b, LESS_THAN_OR_EQUAL: (a, b) => a <= b, GREATER_THAN: (a, b) => a > b, GREATER_THAN_OR_EQUAL: (a, b) => a >= b }; // A filter value of the column's type. Dates arrive as yyyy-MM-dd, the format the grid's // date field declares, and compare as text. function typed(type, value) { if (type === 'number') return Number(value); if (type === 'date') return String(value).slice(0, 10); return String(value); } // The grid sends filterscount and, for each filter i: filterdatafield, filtercondition, // filtervalue and filteroperator (how it joins the previous filter on the same column: // 0 = and, 1 = or). Filters on different columns all have to match. function filterRows(rows, query) { const count = Math.min(Number(query.filterscount) || 0, 20); const byColumn = new Map(); for (let i = 0; i < count; i++) { const field = query[`filterdatafield${i}`]; const test = TEST[query[`filtercondition${i}`]]; if (!Object.hasOwn(COLUMNS, field) || !Object.hasOwn(TEST, query[`filtercondition${i}`])) continue; const value = typed(COLUMNS[field], query[`filtervalue${i}`]); if (!byColumn.has(field)) byColumn.set(field, []); byColumn.get(field).push({ test, value, or: query[`filteroperator${i}`] === '1' }); } if (!byColumn.size) return rows; return rows.filter((row) => [...byColumn].every(([field, filters]) => filters.reduce((ok, f, i) => { const hit = f.test(row[field], f.value); return i === 0 ? hit : f.or ? ok || hit : ok && hit; }, true) ) ); } app.get('/api/orders', (req, res) => { const query = req.query; let rows = filterRows(orders, query); // Sorting: sortdatafield and sortorder (asc or desc). const field = query.sortdatafield; if (Object.hasOwn(COLUMNS, field)) { const dir = query.sortorder === 'desc' ? -1 : 1; rows = [...rows].sort((a, b) => (a[field] < b[field] ? -dir : a[field] > b[field] ? dir : 0)); } // Paging: pagenum (from 0) and pagesize, kept in a sensible range. const pagesize = Math.min(Math.max(Number(query.pagesize) || 10, 1), 100); const pagenum = Math.max(Number(query.pagenum) || 0, 0); res.json({ total: rows.length, rows: rows.slice(pagenum * pagesize, (pagenum + 1) * pagesize) }); }); const port = Number(process.env.PORT) || 3003; app.listen(port, () => console.log(`Pages and API on http://localhost:${port}`)); ``` `express.static` serves the `public` folder, so the page and the API come from the same address and the grid can use the relative URL `/api/orders`. The port is 3003, or the one in the `PORT` environment variable. #### 3. The grid `virtualmode` tells the grid that the data comes a page at a time, and `rendergridrows` returns the rows the server sent. The source's `beforeprocessing` reads the total from each answer, and `root: 'rows'` tells the adapter where the rows are. The source's `sort` and `filter` functions run when the user sorts or filters; they ask the server again with `updatebounddata`. ```javascript const grid = $('#grid'); // Every page, sort and filter change becomes a request to /api/orders with the grid's // state in its query string. const source = { url: '/api/orders', datatype: 'json', root: 'rows', id: 'id', datafields: [ { name: 'id', type: 'number' }, { name: 'customer', type: 'string' }, { name: 'product', type: 'string' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' }, { name: 'date', type: 'date', format: 'yyyy-MM-dd' } ], totalrecords: 0, // The total of matching rows, so the pager knows how many pages there are. beforeprocessing: (data) => { source.totalrecords = data.total; }, // Sorting and filtering happen on the server: ask it again. sort: () => grid.jqxGrid('updatebounddata', 'sort'), filter: () => grid.jqxGrid('updatebounddata', 'filter') }; const adapter = new $.jqx.dataAdapter(source, { loadError: (xhr, status, error) => { document.getElementById('status').textContent = `Could not load the orders (${status}: ${error}).`; } }); grid.jqxGrid({ theme: 'fluent', width: '100%', height: 560, source: adapter, // With virtualmode, the grid shows the rows the server sent for the current page. virtualmode: true, rendergridrows: (params) => params.data, pageable: true, pagesize: 20, pagesizeoptions: ['20', '50', '100'], sortable: true, filterable: true, showfilterrow: true, columns: [ { text: 'Order', datafield: 'id', width: 80, filterable: false }, { text: 'Customer', datafield: 'customer', width: 200 }, { text: 'Product', datafield: 'product', width: 140 }, { text: 'Quantity', datafield: 'quantity', width: 110, cellsalign: 'right', align: 'right', filtertype: 'number' }, { text: 'Price', datafield: 'price', width: 110, cellsalign: 'right', align: 'right', cellsformat: 'c2', filtertype: 'number' }, { text: 'Date', datafield: 'date', cellsformat: 'yyyy-MM-dd', filtertype: 'range' } ] }); ``` Save the whole page as `public/server-side.html`: ```html Orders

    Orders

    ``` #### Try it Start the server and open `http://localhost:3003/server-side.html`: ```bash node server/server.js ``` The pager reads *1-20 of 10000*. Click the Quantity header twice to sort from the largest order. Type *ernst* in the Customer filter: after a short pause the pager reads *1-20 of 1250*, still sorted by quantity, and the next page continues the same orders. A range in the Date filter arrives as two date filters, such as `2026-02-01` and `2026-02-28`. Each change is one request to `/api/orders`; open the browser's network panel to watch them. (Pressing Enter in a filter after typing sends the same request a second time.) #### Next - The same API in other languages: [PHP](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/phpintegration/php-server-side-grid-paging-and-sorting.htm), [ASP.NET Core](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/asp.net-integration/asp.net-grid-paging-sorting-filtering.htm) and [Java](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/java-integration/grid-server-side-sorting-paging-filtering-using-jsp.htm); the grid's requests are the same - [Large data sets and live updates](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-large-data.htm), when the rows fit in the browser --- ### Export and saving the layout of the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-export-state.htm > This tutorial exports the grid's rows to Excel, CSV, PDF and JSON files, and remembers the grid's layout (sort, filters, page, column widths and order) in the… This tutorial exports the grid's rows to Excel, CSV, PDF and JSON files, and remembers the grid's layout (sort, filters, page, column widths and order) in the browser, so it is back the next time the page opens. The finished example: export buttons, and a grid whose sort, filters and columns are kept between visits. #### Before you start Set up a page as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm). Besides the files for sorting, filtering and paging (without `jqxcheckbox.js` and the date files, which its text filters do not need), this page loads the export and storage modules, the column resize and reorder modules, and JSZip, which the Excel export uses to build the file: ```html ``` `jqxdata.export.js` and `jqxgrid.export.js` are needed for every file type. Excel files also need `jqxexport.js` and JSZip; without them only the Excel export fails, with *Missing reference to 'jszip.min.js'* or, for `jqxexport.js`, *DataExporter is not a constructor*. `jqxgrid.storage.js` saves and loads the layout. #### 1. Export `exportdata(type, fileName)` builds the file in the browser and downloads it. The types are `xlsx`, `csv`, `tsv`, `pdf`, `json`, `xml` and `html`. The file holds every row as the grid sorts and filters it, not only the current page. ```javascript // The rows as the grid shows them now (sorted and filtered), in a file. for (const button of document.querySelectorAll('[data-export]')) { button.addEventListener('click', () => grid.jqxGrid('exportdata', button.dataset.export, 'products')); } ``` The values are written as the cells show them: in CSV the price is `"$62.11"`. In Excel files numbers stay numbers, with the column's format (`$#,0.00`), so they can be summed. A number column without a `cellsformat` is written with two decimals (`79.00`) in the text formats, which is why the In stock column has `cellsformat: 'n0'`. For a printout, `window.print()` prints the page; `exportdata('html', …)` gives a file with the grid's rows as an HTML table, if you prefer to print only those. #### 2. Save the layout `getstate` returns the grid's layout as a plain object: the sort, the page and page size, the filters, the selected rows, the groups, and each column's width, position and visibility. `loadstate(state)` puts it back. The example keeps the layout the page starts with, then puts back the layout of the last visit from `localStorage`: ```javascript // The layout the page starts with, for "Reset the layout". const initialState = grid.jqxGrid('getstate'); // Put back the state of the last visit. let state = null; try { state = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? 'null'); } catch { // ignore a damaged or unreadable entry } if (state) { grid.jqxGrid('loadstate', state); } ``` It saves the layout each time the user sorts, filters, pages, or resizes or moves a column: ```javascript // Sorting, filtering, paging, a resized or moved column: the grid's state is saved each time. grid.on('sort filter pagechanged pagesizechanged columnresized columnreordered', () => { try { localStorage.setItem(STORAGE_KEY, JSON.stringify(grid.jqxGrid('getstate'))); saved.textContent = `Layout saved at ${new Date().toLocaleTimeString()}`; } catch { // storage full or blocked (private window): the grid works without it } }); ``` Use `getstate` rather than `savestate` here. `savestate` returns the same object, but also writes it to `localStorage` under a key of its own (`jqxGrid` followed by the element's id), and throws when the browser blocks storage. Storage can fail (a private window, a full quota, a blocked site), so every access in the example is in a `try` block, and the grid works without it. To keep a user's layout across devices, send the same object to your server instead. *Reset the layout* loads the layout the page started with, column widths included, and forgets the saved one: ```javascript document.getElementById('reset').addEventListener('click', () => { grid.jqxGrid('loadstate', initialState); try { localStorage.removeItem(STORAGE_KEY); } catch { // nothing saved } saved.textContent = 'Sort, filter or resize: the layout is kept for your next visit.'; }); ``` #### The complete example ```html Products

    Products

    Export:

    Sort, filter or resize: the layout is kept for your next visit.

    ``` Click the Price header twice to sort from the most expensive product, and click *Excel*: `products.xlsx` holds all 60 products, the most expensive first. Type *chai* in the Product filter and drag the border between two headers to widen a column, then reload the page: the sort, the filter and the width are back. *Reset the layout* returns to the start. #### Next - [Large data sets and live updates](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-large-data.htm) - [Grouping and aggregates](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-grouping-aggregates.htm) - `exportdata`, `getstate` and `loadstate` in the [jQuery Grid API reference](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm) --- ### Large data sets and live updates in the jQuery Grid Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-large-data.htm > This tutorial puts 100,000 rows in a grid and moves twenty of their prices every second. This tutorial puts 100,000 rows in a grid and moves twenty of their prices every second. It covers the three things that keep such a page fast and tidy: let the grid virtualize, change cells instead of replacing the data, and clean up when the grid goes away. The finished example: 100,000 rows, with twenty prices updated every second in a few milliseconds. #### Before you start Set up a page as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm). The grid sorts, filters from the column menu and resizes columns, so the page loads these files: ```html ``` The timings below were measured in Chromium on a desktop computer. Yours will differ; the proportions between them will not change much. #### 1. Let the grid virtualize With a fixed `height`, the grid creates elements only for the rows in view (16 for this 520-pixel grid) and reuses them as you scroll, whatever the number of rows. `autoheight` makes the grid as tall as its rows, so it creates an element for every row: 2,001 for a 2,000-row table. Keep it for small tables, or use it with paging. ```javascript // A fixed height: the grid then creates elements only for the rows in view and reuses them // as you scroll. (autoheight would create one for every row.) grid.jqxGrid({ theme: 'fluent', width: '100%', height: 520, source: new $.jqx.dataAdapter({ localdata: quotes, datatype: 'array', id: 'id', datafields: [ { name: 'id', type: 'number' }, { name: 'symbol', type: 'string' }, { name: 'exchange', type: 'string' }, { name: 'price', type: 'number' }, { name: 'change', type: 'number' }, { name: 'volume', type: 'number' } ] }), sortable: true, filterable: true, columnsresize: true, columns: [ { text: 'Symbol', datafield: 'symbol', width: 140 }, { text: 'Exchange', datafield: 'exchange', width: 110 }, { text: 'Price', datafield: 'price', width: 120, cellsformat: 'f2', cellsalign: 'right', align: 'right' }, { text: 'Change', datafield: 'change', width: 110, cellsformat: 'f2', cellsalign: 'right', align: 'right', cellclassname: (row, field, value) => (value > 0 ? 'up' : value < 0 ? 'down' : '') }, { text: 'Volume', datafield: 'volume', cellsformat: 'n0', cellsalign: 'right', align: 'right' } ] }); ``` The rows are made once, before the grid is created. With 100,000 rows the grid is created in about 200 milliseconds and shows its first rows about a quarter of a second after the page's scripts have loaded. Sorting all the rows by price takes about 200 milliseconds, a filter on the symbol 10 to 15, and scrolling to the last row 20 to 35. #### 2. Change cells, not the data To change a few values, set the cells: `setcellvalue` for each changed cell, between `beginupdate` and `endupdate` so that the grid draws once. `getrowboundindexbyid` finds a row's index from its id, and `getcellvalue` reads the current value. ```javascript // Twenty of the watched rows change each second. Only the changed cells are set, inside one // beginupdate/endupdate pair, so the grid draws once for all of them. function tick() { const started = performance.now(); grid.jqxGrid('beginupdate'); for (let n = 0; n < 20; n++) { const id = String(1 + Math.floor(Math.random() * WATCHED)); const index = grid.jqxGrid('getrowboundindexbyid', id); const change = Math.round((Math.random() - 0.5) * 200) / 100; grid.jqxGrid('setcellvalue', index, 'price', Math.max(1, grid.jqxGrid('getcellvalue', index, 'price') + change)); grid.jqxGrid('setcellvalue', index, 'change', change); } grid.jqxGrid('endupdate'); lastUpdate.textContent = `20 rows updated in ${(performance.now() - started).toFixed(1)} ms`; } ``` Measured with the 100,000 rows of this page, for twenty rows: | Method | Time | | --- | --- | | `setcellvalue` for each cell, inside `beginupdate`/`endupdate` | 5 to 25 ms | | `updatebounddata` (bind all the rows again) | about 300 ms | | `updaterow` for each row, inside `beginupdate`/`endupdate` | about 1.5 s | | `updaterow` for each row | about 3 s | The Change column colours itself with `cellclassname`, which the grid calls again when a cell changes. Save the two classes as `quotes.css` next to the page: ```css .up { color: #15803d !important; } .down { color: #b91c1c !important; } ``` #### 3. Clean up A page that shows the grid for a while, such as one view of a single-page app, removes it when the view closes. Stop the timer first, then call `destroy`: it removes the grid and all its elements, the element the grid was created on included. Calls to the destroyed grid do nothing, so a timer left running would not fail; it would keep running for nothing. ```javascript // When the grid leaves the page (in a single-page app, when its view closes), stop the // timer first, then destroy the grid: destroy removes the grid and its elements. document.getElementById('remove').addEventListener('click', () => { stopLive(); grid.jqxGrid('destroy'); liveButton.disabled = true; }); ``` To show the grid again, create a new element for it and create the grid on that. #### The complete example ```html Quotes

    Quotes

    ``` The grid opens at once with 100,000 rows, and scrolling, sorting and filtering work on all of them. *Start live updates* moves twenty of the first two hundred prices each second, and the line next to the button gives the time each update took. *Remove the grid* stops the updates and removes the grid. #### Next - [Server-side paging, sorting and filtering](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm), for data that does not fit in the browser - [Sorting, filtering and paging](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-sorting-filtering-paging.htm) --- ### Bind the jQuery Grid to Supabase Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-supabase.htm > Supabase gives every project a PostgreSQL database with a REST API, Row Level Security and live change events. [Supabase](https://supabase.com/) gives every project a PostgreSQL database with a REST API, Row Level Security and live change events. This tutorial connects a jqxGrid to a Supabase table with the official JavaScript client, supabase-js: the database pages, sorts and filters 10,000 orders, edits are saved as the user makes them, and changes made anywhere else appear in the grid while it is open. The finished example: a Supabase table paged, sorted and filtered by the database. #### Before you start You need a Supabase project: a free one at [supabase.com/dashboard](https://supabase.com/dashboard), or a local one with the [Supabase CLI](https://supabase.com/docs/guides/local-development) (`supabase start`). The page is a plain HTML file that loads jQWidgets and supabase-js from CDNs, as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm); serve it from any web server, such as `npx serve`. #### 1. The table Run this SQL in the dashboard's SQL editor (or as a migration). It creates an `orders` table with 10,000 sample rows, and says what the browser may do with it: ```sql -- The orders table: 10,000 sample orders, and what the browser may do with them. create table public.orders ( id bigint generated always as identity primary key, customer text not null, product text not null, quantity integer not null check (quantity > 0), price numeric(10, 2) not null check (price >= 0), order_date date not null, status text not null default 'New' check (status in ('New', 'Shipped', 'Delivered', 'Cancelled')) ); -- 10,000 sample orders insert into public.orders (customer, product, quantity, price, order_date, status) select (array['Alfreds Futterkiste', 'Ana Trujillo', 'Antonio Moreno', 'Around the Horn', 'Berglunds snabbköp', 'Blauer See Delikatessen', 'Bólido Comidas', 'Ernst Handel'])[1 + i % 8], (array['Chai', 'Chang', 'Aniseed Syrup', 'Tofu', 'Konbu', 'Pavlova', 'Ikura', 'Queso Cabrales', 'Gnocchi', 'Mozzarella'])[1 + (i * 7) % 10], 1 + (i * 13) % 50, round((5 + (i * 37) % 9500 / 100.0)::numeric, 2), current_date - (i % 365), (array['New', 'Shipped', 'Delivered', 'Cancelled'])[1 + (i * 3) % 4] from generate_series(1, 10000) as i; -- Row Level Security: the browser uses the anon key, so the table says what that key may do. -- Here anyone may read orders and change their quantity and status; a real app checks the -- signed-in user (auth.uid()) in these policies. alter table public.orders enable row level security; create policy "Orders are readable" on public.orders for select to anon, authenticated using (true); create policy "Orders can be updated" on public.orders for update to anon, authenticated using (true) with check (true); grant select on public.orders to anon, authenticated; grant update (quantity, status) on public.orders to anon, authenticated; -- Realtime: changes to the table are sent to subscribed browsers (the same as switching on -- Realtime for the table in the dashboard). alter publication supabase_realtime add table public.orders; ``` The browser connects with the project's anon key, which anyone can read in the page's source. What it may do is decided in the database: **Row Level Security** is switched on and two policies allow reading and updating, and the column grants allow changing only `quantity` and `status`. An update of the price is refused by the database, whatever the page sends. In a real app the policies check the signed-in user, for example `using (auth.uid() = owner_id)`. The last line adds the table to Realtime, for step 5. #### 2. Connect supabase-js is an ES module, so the page's script is `

    Orders

    ``` #### Try it Open the page. The pager reads *1-20 of 10000*. Click the Quantity header twice to sort from the largest order, and type *ernst* in the Customer filter: the pager reads *1-20 of 1250*, still sorted. Type a name that no order has: the grid is empty and the pager reads *0-0 of 0*. Double-click a status, pick *Delivered*, and see the row change in the Table Editor of the dashboard. Open the page in a second tab and change a quantity in the first: the second tab shows it a moment later. #### Next - [Bind the jQuery Grid to Cloud Firestore](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-firebase.htm) and [to a GraphQL API](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-graphql.htm) - [Editing and validation](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-editing.htm): the grid's editors and validation in detail - [Row Level Security](https://supabase.com/docs/guides/database/postgres/row-level-security) in the Supabase documentation --- ### Bind the jQuery Grid to Cloud Firestore Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-firebase.htm > jQuery Grid: cloud Firestore, the database of Firebase, keeps documents in collections and tells a listening app about every change. [Cloud Firestore](https://firebase.google.com/docs/firestore), the database of Firebase, keeps documents in collections and tells a listening app about every change. This tutorial shows the two ways to put a collection in a jqxGrid: a live grid that holds the latest orders and changes with the database, and a grid that reads a large collection a page at a time with query cursors. Edits are written back to the documents, and the database's security rules decide what is accepted. The live grid: the latest 500 orders of a Firestore collection. #### Before you start You need a Firebase project with Cloud Firestore ([console.firebase.google.com](https://console.firebase.google.com/)), or the [Firestore emulator](https://firebase.google.com/docs/emulator-suite) on your computer: `npx firebase-tools emulators:start --only firestore --project demo-jqwidgets` (it needs Java 21). The examples use the emulator and a collection `orders` with fields `customer`, `product`, `quantity`, `price`, `orderDate` (a timestamp) and `status`. The pages are plain HTML files that load jQWidgets from jsDelivr and the Firebase SDK from Google's CDN. #### 1. Connect The Firebase SDK is a set of ES modules, so the script is `

    Orders

    ``` The paged grid, `firebase-pages.html`: ```html Orders from Cloud Firestore, a page at a time

    Orders

    ``` #### Try it Start the emulator and add some orders (the emulator's UI, or a short script with `addDoc`), then open `firebase.html`. Change a document in the Firebase console or the emulator UI: its row changes in the grid. Add an order dated today: it appears at the top. In `firebase-pages.html`, go to page 3, then click the Quantity header: Firestore sorts and the grid shows page 3 of the new order. #### Next - [Bind the jQuery Grid to Supabase](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-supabase.htm) and [to a GraphQL API](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-graphql.htm) - [Large data and live updates](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-large-data.htm): how fast the grid takes many small updates - [Security rules](https://firebase.google.com/docs/firestore/security/get-started) in the Firebase documentation --- ### Bind the jQuery Grid to a GraphQL API Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-graphql.htm > With GraphQL, the client says exactly which fields it wants and sends its arguments as typed variables. With GraphQL, the client says exactly which fields it wants and sends its arguments as typed variables. This tutorial connects a jqxGrid to a GraphQL API with nothing but `fetch`: a query brings one page of orders, sorted and filtered on the server, and a mutation saves each edit. It builds the API too, with [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server) on Node.js; the grid's side works the same with any GraphQL server, such as Apollo Server, Hasura or a.NET or Java one. The finished example: 10,000 orders from a GraphQL API, a page at a time. #### Before you start You need Node.js 22 or later for the API. Create a project and install GraphQL Yoga: ```bash npm init -y npm install graphql graphql-yoga npm pkg set type=module ``` The page, `graphql.html`, loads jQWidgets from the CDN as in [Bind the jQuery Grid to data](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-data-binding.htm), with the files for sorting, filtering, paging and editing. #### 1. The API Save this as `server.js` and start it with `node server.js`. The schema is the contract between the grid and the server: an `orders` query with an offset, a page size, a sort and a list of filters, which returns the rows of the page and the number of matching orders, and an `updateOrder` mutation. ```javascript // A GraphQL API for the grid: orders a page at a time, sorted and filtered on the // server, and a mutation that changes an order. GraphQL Yoga, on Node.js. // node server.js (http://localhost:4000/graphql, or the port in PORT) import { createServer } from 'node:http'; import { createSchema, createYoga } from 'graphql-yoga'; import { GraphQLError } from 'graphql'; const typeDefs = /* GraphQL */ ` enum OrderField { id customer product quantity price orderDate status } enum Condition { CONTAINS EQUAL NOT_EQUAL GREATER_THAN LESS_THAN GREATER_THAN_OR_EQUAL LESS_THAN_OR_EQUAL } enum Status { New Shipped Delivered Cancelled } type Order { id: ID! customer: String! product: String! quantity: Int! price: Float! orderDate: String! status: Status! } type OrderPage { rows: [Order!]! total: Int! } input OrderFilter { field: OrderField! condition: Condition! value: String! } input OrderSort { field: OrderField! descending: Boolean = false } type Query { orders(offset: Int = 0, limit: Int = 20, sort: OrderSort, filters: [OrderFilter!] = []): OrderPage! } type Mutation { updateOrder(id: ID!, quantity: Int, status: Status): Order! } `; // 10,000 orders in memory, to keep the example self-contained; a real API asks its database. const customers = ['Alfreds Futterkiste', 'Ana Trujillo', 'Antonio Moreno', 'Around the Horn', 'Berglunds snabbköp', 'Blauer See Delikatessen', 'Bólido Comidas', 'Ernst Handel']; const products = ['Chai', 'Chang', 'Aniseed Syrup', 'Tofu', 'Konbu', 'Pavlova', 'Ikura', 'Queso Cabrales', 'Gnocchi', 'Mozzarella']; const statuses = ['New', 'Shipped', 'Delivered', 'Cancelled']; const today = new Date(); const orders = Array.from({ length: 10000 }, (_, k) => { const i = k + 1; const date = new Date(today.getFullYear(), today.getMonth(), today.getDate() - (i % 365)); return { id: String(i), customer: customers[i % 8], product: products[(i * 7) % 10], quantity: 1 + (i * 13) % 50, price: Math.round(500 + (i * 37) % 9500) / 100, orderDate: `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`, status: statuses[(i * 3) % 4] }; }); const numeric = new Set(['quantity', 'price']); const value = (order, field) => (field === 'id' ? Number(order.id) : order[field]); function matches(order, { field, condition, value: text }) { const v = value(order, field); const want = numeric.has(field) || field === 'id' ? Number(text) : text; if (typeof want === 'number' && Number.isNaN(want)) return false; switch (condition) { case 'CONTAINS': return String(v).toLowerCase().includes(String(want).toLowerCase()); case 'EQUAL': return typeof v === 'string' ? v.toLowerCase() === String(want).toLowerCase() : v === want; case 'NOT_EQUAL': return typeof v === 'string' ? v.toLowerCase() !== String(want).toLowerCase() : v !== want; case 'GREATER_THAN': return v > want; case 'LESS_THAN': return v < want; case 'GREATER_THAN_OR_EQUAL': return v >= want; case 'LESS_THAN_OR_EQUAL': return v <= want; } return false; } // (GraphQLError: Yoga shows its message to the client; other errors become "Unexpected error.") const resolvers = { Query: { orders(_, { offset, limit, sort, filters }) { let rows = orders.filter((o) => filters.every((f) => matches(o, f))); if (sort) { const dir = sort.descending ? -1 : 1; rows = [...rows].sort((a, b) => { const x = value(a, sort.field), y = value(b, sort.field); return (x < y ? -1 : x > y ? 1 : 0) * dir; }); } const size = Math.min(Math.max(limit, 1), 200); return { rows: rows.slice(Math.max(offset, 0), Math.max(offset, 0) + size), total: rows.length }; } }, Mutation: { updateOrder(_, { id, quantity, status }) { const order = orders.find((o) => o.id === id); if (!order) throw new GraphQLError(`No order ${id}`); if (quantity != null) { if (!Number.isInteger(quantity) || quantity < 1) throw new GraphQLError('The quantity must be a whole number above 0'); order.quantity = quantity; } if (status != null) order.status = status; return order; } } }; const yoga = createYoga({ schema: createSchema({ typeDefs, resolvers }) }); const port = Number(process.env.PORT) || 4000; createServer(yoga).listen(port, () => console.log(`GraphQL API on http://localhost:${port}/graphql`)); ``` The enums do the checking: a sort or filter on a field the schema does not name, or a condition it does not have, is refused before a resolver runs. The data is generated in memory to keep the example self-contained; a real API asks its database in the resolvers. Errors meant for the user are thrown as `GraphQLError`, which Yoga passes on; any other error reaches the client as *Unexpected error.*, so a server's internals do not leak. Yoga answers the browser's cross-origin requests, so the page can come from another address. #### 2. Requests A GraphQL request is a POST with the query and its variables as JSON. The answer has `data`, and `errors` when something failed, with the same HTTP status in both cases. This function returns the data or throws the first error: ```javascript // A GraphQL request: the query and its variables in, the data or the first error out. async function graphql(query, variables) { const response = await fetch(GRAPHQL_URL, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ query, variables }) }); const { data, errors } = await response.json(); if (errors?.length) throw new Error(errors[0].message); return data; } ``` The query asks for the fields the grid shows, and the mutation for the fields it changes: ```javascript const ORDERS = /* GraphQL */ ` query Orders($offset: Int!, $limit: Int!, $sort: OrderSort, $filters: [OrderFilter!]) { orders(offset: $offset, limit: $limit, sort: $sort, filters: $filters) { total rows { id customer product quantity price orderDate status } } }`; const UPDATE_ORDER = /* GraphQL */ ` mutation UpdateOrder($id: ID!, $quantity: Int, $status: Status) { updateOrder(id: $id, quantity: $quantity, status: $status) { id quantity status } }`; ``` #### 3. The grid's state as variables The grid runs in virtual mode, as in [Server-side processing](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm), and the data adapter gets a `loadServerData` function instead of a URL. It receives the grid's page, sort and filters; `variables` turns them into the query's arguments, keeping only the fields and conditions the schema has: ```javascript // The grid's state as the query's variables function variables(params) { const filters = []; for (let i = 0; i < Number(params.filterscount || 0); i++) { const field = params['filterdatafield' + i], condition = params['filtercondition' + i]; if (fieldNames.has(field) && conditions.has(condition)) { filters.push({ field, condition, value: String(params['filtervalue' + i]) }); } } const sort = fieldNames.has(params.sortdatafield) && params.sortorder ? { field: params.sortdatafield, descending: params.sortorder === 'desc' } : null; return { offset: params.pagenum * params.pagesize, limit: params.pagesize, sort, filters }; } ``` ```javascript // One page of orders for the grid's state async function loadOrders(params) { try { const { orders } = await graphql(ORDERS, variables(params)); status.textContent = ''; return { records: orders.rows, totalrecords: orders.total }; } catch (error) { status.textContent = `Could not load the orders: ${error.message}`; return { records: [], totalrecords: 0 }; } } ``` ```javascript const source = { datatype: 'json', id: 'id', datafields, // The adapter needs a url to ask for data; loadServerData below does the asking. url: GRAPHQL_URL, totalrecords: 0, // Sorting and filtering happen on the server: ask again. sort: () => grid.jqxGrid('updatebounddata', 'sort'), filter: () => grid.jqxGrid('updatebounddata', 'filter') }; const adapter = new $.jqx.dataAdapter(source, { // The adapter calls this instead of requesting the url. (A plain function: // versions before 27.1.0 ignore an async one.) loadServerData: (params, settings, callback) => { loadOrders(params).then((result) => { // (versions before 27.1.0 keep the previous total when the new one is 0: set it here) adapter.totalrecords = result.totalrecords; callback(result); }); } }); ``` `loadServerData` is a plain function that calls the async `loadOrders`, and it sets `adapter.totalrecords` itself. Both are for versions before 27.1.0, which ignore an async function there and keep the previous total when a filter matches nothing; they do no harm in 27.1.0. #### 4. Save edits with a mutation A changed cell becomes an `updateOrder` mutation with the order's id and the one changed field. If the API refuses it, the cell gets its old value back and the page shows the API's message: ```javascript // An edit is sent as a mutation; if the API refuses it, the cell gets its old value back. let applying = false; async function saveEdit({ datafield, rowindex, oldvalue, newvalue }) { const row = grid.jqxGrid('getrowdata', rowindex); try { await graphql(UPDATE_ORDER, { id: row.id, [datafield]: newvalue }); status.textContent = `Order ${row.id} saved.`; } catch (error) { status.textContent = `Order ${row.id} was not saved: ${error.message}`; applying = true; grid.jqxGrid('setcellvalue', rowindex, datafield, oldvalue); applying = false; } } grid.on('cellvaluechanged', (event) => { if (!applying) saveEdit(event.args); }); ``` #### The whole page ```html Orders from a GraphQL API

    Orders

    ``` #### Try it Start the API with `node server.js` and open the page from any web server. The pager reads *1-20 of 10000*. Sort by Quantity, type *ernst* in the Customer filter (*1-20 of 1250*), and pick *Shipped* in the Status filter. Change a status: the network panel shows one `updateOrder` mutation. To try the API on its own, open `http://localhost:4000/graphql`: Yoga serves GraphiQL there. #### Next - [Bind the jQuery Grid to Supabase](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-supabase.htm) and [to Cloud Firestore](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-firebase.htm) - [Server-side processing](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-server-side.htm) with a REST API and the grid's own requests --- ### Get started with the JavaScript Gantt chart (jqxGantt) Source: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgantt/gantt-getting-started.htm > jQuery Gantt getting started: install jQWidgets, add jqxGantt to your app, see a complete example, then handle its events and call its methods. jqxGantt shows a project schedule. A tree on the left lists the tasks; a timeline on the right draws each task as a bar from its start date to its end date, so the width of a bar is the task's duration. Lines between the bars show which task has to wait for which. This guide builds a Gantt chart in plain JavaScript, step by step: load the files, create the chart, describe tasks, projects and milestones, connect them, change them with methods, choose the tree's columns, translate the chart, let it schedule the tasks, and save the plan. Each example is a single HTML page that you can save and open. None of them needs jQuery or a build step. #### Load the files The examples load jQWidgets 27 from the jsDelivr CDN. A page with a Gantt chart needs three stylesheets and three scripts: ```html ``` | File | What it adds | | --- | --- | | `styles/jqx.base.css` | The styles all widgets share | | `styles/gantt/jqx.gantt.css` | The Gantt chart's own styles | | `styles/jqx.fluent.css` | The theme (`fluent` here). Any theme works; set the same name in the chart's `theme` option. | | `jqxcore.js` | The core of every widget | | `jqxgantt.js` | The `jqxGantt` widget that your code creates | | `jqxgantt.api.js` | The chart itself, which the widget draws in a `jqx-gantt-chart` element | Load the theme **after** `jqx.gantt.css`. The Gantt stylesheet sets its own default colours, and a theme loaded before it loses to them: with `jqx.tailwind-dark.css` first, the chart stays light. Without `jqxcore.js` or `jqxgantt.js` the page stops with *jqxGantt is not defined*; without `jqxgantt.api.js` nothing is drawn. To install from npm instead, run `npm install jqwidgets-scripts` and replace `https://cdn.jsdelivr.net/npm/jqwidgets-scripts@27/` with `node_modules/jqwidgets-scripts/` in the same tags. #### Create your first Gantt chart Here is a complete page: a product launch plan of seven tasks, each coloured by the team that does it, with a column for the number of days each one takes. ```html jqxGantt: a product launch plan
    ``` The launch plan: one row per task, bars coloured by team. `new jqxGantt(selector, options)` creates the chart in the element that the selector finds. The options used here: - `source` is the list of tasks. The next section describes it. - `width: '100%'` fills the parent element. `height: 'auto'` makes the chart as tall as its rows; a number or a CSS size gives it a fixed height and a scroll bar. - `view` sets the time unit of the timeline: `'day'`, `'week'`, `'month'`, `'quarter'` or `'year'` (the default). `'quarter'` shows the months of each quarter, which suits a plan of a few months. - `treeSize` is the width of the task tree (by default `'20%'`), and `taskColumns` lists its columns. Without `taskColumns` the tree has one column, *Task Name*. - `durationUnit: 'day'` makes each task's `duration` a number of days. The *Days* column shows it, rounded by its `formatFunction`. - The `class` of a task is added to its bar. The page's stylesheet sets `--jqx-gantt-chart-task-color` and `--jqx-gantt-chart-task-label-color` for each team class. The other examples in this guide are pages like this one: the same files in the ``, a `
    `, and their code in a `
    ``` The plan and its resource panel. Ben has two tasks on April 13 and 14: 12 hours, in red. There is no list of resources apart from the tasks: `new jqxGantt('#gantt', { resources: [...] })` throws *Invalid property: resources*. The chart collects the resources from the tasks' `resources` fields, in the order in which they first appear, and keeps each field as a list of ids: `getTask('testing').resources` is `['dan', 'chloe']`. To add a resource that has no tasks yet, use `insertResource`. A [task column](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgantt/gantt-getting-started.htm#task-columns) whose `value` is `'resources'` shows the ids, separated by commas. Its `formatFunction` receives the list of ids, so the *Owner* column above turns them into labels with `getResource`. The plan is drawn in the `week` view, one column per day, with Saturday and Sunday as nonworking days. A `dateEnd` of `'2026-04-09T00:00:00'` ends a task at midnight at the start of April 9, so Wireframes takes Monday to Wednesday. `adjustToNonworkingTime: true` keeps the weekends out of the hours: without it, Visual design counts 8 hours on Saturday and Sunday too. The [working time page](https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgantt/jquery-gantt-working-time.htm) explains both options. The page's stylesheet narrows the day columns so that the two weeks fit, and `resourcePanelSize` makes the panel as tall as its four rows (see The resource panel). #### Resource fields A resource object can have these fields. `getResources()` returns copies of the resources with these fields, the calculated ones included: | Field | Meaning | | --- | --- | | `id` | The name that tasks and methods use to find the resource. Required: an object without an `id` is not taken as a resource. | | `label` | The text in the resource panel | | `capacity` | The hours a day the resource spends on each of its tasks. 8 when not given. | | `maxCapacity` | The hours a day the resource has. More than this is drawn in red. 24 when not given, so set it. | | `minCapacity` | Kept with the resource (0 when not given), but the chart does not use it | | `class` | A CSS class for the resource's cells in the resource timeline | | `progress` | Calculated: the average `progress` of the resource's tasks, each task counting once whatever its length. A value you give is replaced. | | `workload` | Calculated: the number of days of the resource's tasks times its `maxCapacity`. A value you give is ignored. | In the plan above, Ana's two tasks are 100% and 40% done, so her *Done* column shows 70%. Ben's tasks take 8 and 2 working days, so his *Work* is 10 × 8 = 80 hours. Note that `workload` uses `maxCapacity`, not `capacity`: it is the hours Ben would work at his maximum, not the 60 hours he is booked for. To show the booked hours, count them yourself, as in Find who is over-allocated. #### The resource panel The panel appears under the tasks as soon as one resource exists. Its tree on the left lists the resources, and its timeline on the right has the same columns as the task timeline. These options set it up: | Option | What it does | | --- | --- | | `hideResourcePanel` | `true` hides the panel, even when there are resources | | `resourceColumns` | The columns of the panel's tree, like `taskColumns`: `label`, `value` (a resource field), `size` and `formatFunction`. One column, *Resource Name*, when not given. | | `resourcePanelSize` | The height of the panel | | `resourcePanelMin` | The smallest height that users can give the panel by dragging the splitter above it (100 by default) | | `resourcePanelHeaderTemplate` | A row above the panel: a function that fills the header element it receives, a `