jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
140 lines (137 loc) • 5.17 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title id="Description">Resolving jQWidgets Script Dependencies with RequireJS</title>
<script type="text/javascript" data-main="requirejs-grid-main" src="../../../scripts/require.js"></script>
<link type="text/css" rel="Stylesheet" href="../../../jqwidgets/styles/jqx.base.css" />
</head>
<body>
<div style="visibility: hidden;" id='jqxWidget'>
<div id="jqxgrid">
</div>
<div style='margin-top: 20px;'>
<div style='float: left;'>
<input type="button" value="Export to Excel" id='excelExport' />
</div>
</div>
</div>
</body>
</html>
<!--=====requirejs-grid-main.js======
require.config({
paths: {
"jquery": "../../scripts/jquery-1.10.2.min",
"jqxcore": "../../../jqwidgets/jqxcore",
"jqxdata": "../../../jqwidgets/jqxdata",
"jqxdata.export": "../../../jqwidgets/jqxdata.export",
"jqxgrid": "../../../jqwidgets/jqxgrid",
"jqxgrid.columnsresize": "../../../jqwidgets/jqxgrid.columnsresize",
"jqxgrid.edit": "../../../jqwidgets/jqxgrid.edit",
"jqxgrid.export": "../../../jqwidgets/jqxgrid.export",
"jqxgrid.selection": "../../../jqwidgets/jqxgrid.selection",
"jqxbuttons": "../../../jqwidgets/jqxbuttons",
"jqxscrollbar": "../../../jqwidgets/jqxscrollbar",
"jqxmenu": "../../../jqwidgets/jqxmenu",
"demos": "../../scripts/demos"
},
shim: {
"jqxcore": {
export: "$",
deps: ["jquery"]
},
"jqxdata": {
export: "$",
deps: ["jquery", "jqxcore"]
},
"jqxdata.export": {
export: "$",
deps: ["jquery", "jqxcore", "jqxdata"]
},
"jqxgrid": {
export: "$",
deps: ["jquery", "jqxcore", "jqxdata"]
},
"jqxgrid.columnsresize": {
export: "$",
deps: ["jquery", "jqxcore", "jqxgrid"]
},
"jqxgrid.edit": {
export: "$",
deps: ["jquery", "jqxcore", "jqxgrid"]
},
"jqxgrid.export": {
export: "$",
deps: ["jquery", "jqxcore", "jqxdata.export", "jqxgrid"]
},
"jqxgrid.selection": {
export: "$",
deps: ["jquery", "jqxcore", "jqxgrid"]
},
"jqxbuttons": {
export: "$",
deps: ["jquery", "jqxcore", "jqxgrid"]
},
"jqxscrollbar": {
export: "$",
deps: ["jquery", "jqxcore", "jqxgrid"]
},
"jqxmenu": {
export: "$",
deps: ["jquery", "jqxcore", "jqxgrid"]
}
}
});
require(["requirejs-grid-app"], function (App) {
App.initialize();
});
====requirejs-grid-app.js=====
define(["jquery", "demos", "jqxcore", "jqxdata", "jqxdata.export", "jqxgrid", "jqxgrid.columnsresize", "jqxgrid.edit", "jqxgrid.export", "jqxgrid.selection", "jqxbuttons", "jqxscrollbar", "jqxmenu"], function () {
var initialize = function () {
$(document).ready(function () {
// renderer for grid cells.
var numberrenderer = function (row, column, value) {
return '<div style="text-align: center; margin-top: 5px;">' + (1 + value) + '</div>';
}
// create Grid datafields and columns arrays.
var datafields = [];
var columns = [];
for (var i = 0; i < 26; i++) {
var text = String.fromCharCode(65 + i);
if (i == 0) {
var cssclass = 'jqx-widget-header';
columns[columns.length] = { pinned: true, exportable: false, text: "", columntype: 'number', cellclassname: cssclass, cellsrenderer: numberrenderer };
}
datafields[datafields.length] = { name: text };
columns[columns.length] = { text: text, datafield: text, width: 60, align: 'center' };
}
var source =
{
unboundmode: true,
totalrecords: 100,
datafields: datafields,
updaterow: function (rowid, rowdata) {
// synchronize with the server - send update command
}
};
var dataAdapter = new $.jqx.dataAdapter(source);
// initialize jqxGrid
$("#jqxgrid").jqxGrid(
{
width: 670,
source: dataAdapter,
editable: true,
columnsresize: true,
selectionmode: 'multiplecellsadvanced',
columns: columns
});
$("#excelExport").jqxButton();
$("#excelExport").click(function () {
$("#jqxgrid").jqxGrid('exportdata', 'xls', 'jqxGrid', false);
});
});
$("#jqxWidget").css('visibility', 'visible');
};
return {
initialize: initialize
};
});-->