jQWidgets Forums
-
Search Results
-
Topic: Problem with export.php
Topic: grid No data to display
Topic: Angular2 Webpack budle js
I am new to Angular2 and Webpack. I used this: https://github.com/damienbod/Angular2WebpackVisualStudio as an starting point to set up an JQWidget prototype for our company. I thought it would be possible to bundle all the JS files into one file, but i am having difficulties with the JQWidget JS files. (For example:
Index.html:<!doctype html> <html> <head> <base href="/"> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Angular 2 Webpack Template</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <my-app>Loading...</my-app> </body> </html>
vendor.ts
import 'jquery/src/jquery'; import 'bootstrap/dist/js/bootstrap'; import './css/bootstrap.css'; import './css/bootstrap-theme.css'; import './styles/jqx.base.css'; import './scripts/jqxcore'; import './scripts/jqxdraw'; import './scripts/jqxbargauge';
main-aot.ts:
// Entry point for AoT compilation. export * from './polyfills'; export * from './vendor'; import { platformBrowser } from '@angular/platform-browser'; import { enableProdMode } from '@angular/core'; import { AppModuleNgFactory } from './app.module.ngfactory'; enableProdMode(); platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
Tsconfig-aot.json
{ "compilerOptions": { "target": "es2015", "module": "es2015", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "suppressImplicitAnyIndexErrors": true, "outDir": "./wwwroot/aot", "rootDir": "./app", "typeRoots": [ "./node_modules/@types" ], "types": [ "node" ] }, "angularCompilerOptions": { "skipMetadataEmit": true }, "exclude": [ "node_modules", "aot" ] }
var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var CopyWebpackPlugin = require('copy-webpack-plugin'); var CleanWebpackPlugin = require('clean-webpack-plugin'); console.log("@@@@@@@@@ USING DEVELOPMENT @@@@@@@@@@@@@@@"); module.exports = { devtool: 'source-map', performance: { hints: false }, entry: { 'app': './app/main.ts' // JiT compilation }, output: { path: "./wwwroot/", filename: 'dist/[name].bundle.js', publicPath: "/" }, resolve: { extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'] }, devServer: { historyApiFallback: true, stats: 'minimal', outputPath: path.join(__dirname, 'wwwroot/') }, module: { rules: [ { test: /\.ts$/, loaders: [ 'awesome-typescript-loader?tsconfig=tsconfig.json', 'angular2-template-loader' ] }, { test: /\.(png|jpg|gif|ico|woff|woff2|ttf|svg|eot)$/, exclude: /node_modules/, loader: "file-loader?name=assets/[name]-[hash:6].[ext]", }, { test: /\.css$/, exclude: /node_modules/, loader: "style-loader!css-loader" }, { test: /\.scss$/, exclude: /node_modules/, loaders: ["style-loader", "css-loader", "sass-loader"] }, { test: /\.html$/, loader: 'raw-loader' } ], exprContextCritical: false }, plugins: [ new CleanWebpackPlugin( [ './wwwroot/dist', './wwwroot/fonts', './wwwroot/assets' ] ), new HtmlWebpackPlugin({ filename: 'index.html', inject: 'body', template: 'index.html' }), new CopyWebpackPlugin([ { from: './angular2App/images/*.*', to: "assets/", flatten: true } ]) ], resolve: { modules: [ 'node_modules', path.resolve(__dirname, 'app') ], extensions: ['.ts', '.js'] }, };
But i am getting errors like:
jqxBaseFramework is not definedHi guys,
I’m trying to do a very simple window with two datetime picker, a submit button and a grid, basically I have would like to reload the grid with the new datetime values everytime I press the submit button. When I press the button I receive the message:
TypeError: jQuery(...).jqGrid is not a function jQuery("#jqxgrid").jqGrid("setGridParam", {datatype: "json"})
Questions are:
1 – Googling I read that depends on the scripts import order, but it’s seems ok, can you tell more about this?
2 – Should I define first the grid and then populate it with fresh data each time the submit button is pressed? If so, could you post code about it?P.S. I’m not very expert, any suggestion about the code will be appreciated.
This is the main part of the code:
Html:
<!DOCTYPE html> <html lang="it-it" dir="ltr" xml:lang="it-it" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <base href="http://localhost/JOOMLA/index.php/it/tabella-dati"> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <meta content="Super User" name="author"> <meta content="Sito per Steiel per la configurazione e gestione dei dispositivi RW14" name="description"> <meta content="Joomla! - Open Source Content Management" name="generator"> <title>Tabella Dati</title> <link rel="canonical" href="http://localhost/JOOMLA/index.php/it/tabella-dati?id_dispositivo=16&nome_dispositivo=s15_007"> <link type="image/vnd.microsoft.icon" rel="shortcut icon" href="/JOOMLA/templates/protostar/favicon.ico"> <link type="text/css" href="/JOOMLA/media/system/css/jqx.base.css" rel="stylesheet"> <link type="text/css" href="/JOOMLA/media/system/css/jqx.orange.css" rel="stylesheet"> <link type="text/css" href="/JOOMLA/templates/protostar/css/template_blue.css" rel="stylesheet"> <link type="text/css" href="/JOOMLA/media/mod_languages/css/template.css" rel="stylesheet"> <script type="text/javascript" src="/JOOMLA/media/jui/js/jquery.min.js"> <script type="text/javascript" src="/JOOMLA/media/jui/js/jquery-noconflict.js"> <script type="text/javascript" src="/JOOMLA/media/jui/js/jquery-migrate.min.js"> <script type="text/javascript" src="/JOOMLA/media/system/js/caption.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxcore.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxgrid.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxgrid.sort.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxgrid.pager.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxgrid.selection.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxgrid.edit.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxdatetimeinput.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxcalendar.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxtooltip.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxbuttons.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/globalization/globalize.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxdata.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxmenu.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxcheckbox.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxlistbox.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxdropdownlist.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxinput.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxscrollbar.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxwindow.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxtabs.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxchart.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxchart.rangeselector.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxdata.export.js"> <script type="text/javascript" src="/JOOMLA/media/system/jqWidgets/jqxgrid.export.js"> <script type="text/javascript" src="/JOOMLA/media/jui/js/bootstrap.min.js"> <script type="text/javascript" src="/JOOMLA/templates/protostar/js/template.js"> <script type="text/javascript"> <link type="text/css" rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans"> <style type="text/css"> </head> .... //jqGrid and other stuff definition </html>
Javascript:
jQuery(document).ready(function() { lang = jQuery("#lang").val(); jQuery.get("../../media/system/labels_inth/lang.php", { "lang" : lang, "mode" : 2 }, function(data, success) { labels = JSON.parse(data); main_function(); }); }); function main_function() { createGrid(); jQuery("#jqxButton_submit").on('click', function() { jQuery("#jqxgrid").jqGrid("setGridParam", {datatype: "json"}).trigger("reloadGrid", [{current: true}]); }); }; function createGrid(){ var dataFields = [ { name: 'utc', map:'can>utc', type:'date'}, { name: 'local', map:'can>local', type:'date'}, { name: 'ch01', map:'can>ch01'}, { name: 'ch02', map:'can>ch02'}, { name: 'ch03', map:'can>ch03'}, { name: 'ch04', map:'can>ch04'}, { name: 'ch05', map:'can>ch05'}, { name: 'ch06', map:'can>ch06'}, { name: 'al01', map:'can>al01'}, { name: 'al02', map:'can>al02'}, { name: 'al03', map:'can>al03'}, { name: 'al04', map:'can>al04'}, { name: 'al05', map:'can>al05'}, { name: 'al06', map:'can>al06'} ]; var data_da = jQuery("#jqxDaData").jqxDateTimeInput("value"); var data_a = jQuery("#jqxAData").jqxDateTimeInput("value"); var da_def = data_da.getFullYear() + "-" + (data_da.getMonth() + 1 ) + "-" + data_da.getDate() + " 00:00:00"; var a_def = data_a.getFullYear() + "-" + (data_a.getMonth() + 1) + "-" + data_a.getDate() + " 23:59:59"; var id_face = jQuery("#jqxDDLiface").jqxDropDownList("getSelectedItem").originalItem.id; var url_get_new = url_get + "?iface=" + id_face + "&id_disp=" + id_dispositivo + "&a=" + a_def + "&da=" + da_def + "&type_date=" + type_date; jQuery.get(url_get, { "type" : "columns_series", "iface" : id_face, "id_disp" : id_dispositivo, "a" : a_def, "da" : da_def }) .done(function(data) { var phpColumns = JSON.parse(data).columns; var phpSeries = JSON.parse(data).seriesGroup; var source = { datatype : "json", datafields : dataFields, id : 'Data', url : url_get_new, root : 'dati', updaterow: function (rowid, rowdata, commit) { var year = rowdata.local.getFullYear(); var month = rowdata.local.getMonth() + 1; var day = rowdata.local.getDate(); var hours = rowdata.local.getHours(); var minutes=rowdata.local.getMinutes(); var seconds = rowdata.local.getSeconds(); var date = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds ; jQuery.ajax({ dataType: 'json', url: url_get, data: "type=update&id_disp=" + id_dispositivo + "&local=" + date + "¬e=" + rowdata.note, success: function (data, status, xhr) {alert("SI");commit(true);}, error: function () {alert("NO");commit(false);} }); } }; if (jQuery('#jqxTabs').jqxTabs('selectedItem') == 0) { var dataAdapter = new jQuery.jqx.dataAdapter(source); jQuery("#jqxgrid").jqxGrid({ width : "98%", height : "520", autoHeight : false, source : dataAdapter, scrollmode : 'logical', editable: true, pageable: false, selectionmode: 'singlecell', editmode: 'click', columns : phpColumns, }); } jQuery("#jqxgrid").on('bindingcomplete', function(event) { jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "utc", 'hidden', true); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "local", 'width', 140); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "local", 'editable', false); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "ch01", 'editable', false); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "ch02", 'editable', false); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "ch03", 'editable', false); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "ch04", 'editable', false); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "ch05", 'editable', false); jQuery("#jqxgrid").jqxGrid('setcolumnproperty', "ch06", 'editable', false); }); }); }
Hi,
I use the Theme Builder to generate my CSS for my GRID. I try to have a different color on my cell border when the mouse pass hover a row. Will like to have the top and bottom black. So fare I generate the CSS but is look that the border-color was not working. I put it red in this exemple. In the theme builder page is look working but when I export it, and using it, I don’t see the color. You can see a demo their, my border was suppose to be red on the mouse hover :
https://jsfiddle.net/kingdomp/c02nzk0b/2/
https://jsfiddle.net/kingdomp/c02nzk0b/2/.jqx-fill-state-hover-GAINGRID, .jqx-widget-GAINGRID .jqx-grid-cell-hover-GAINGRID
{
color: #000000;
text-shadow: none;
border-color: #FF0000;
background-color: transparent;
background-image: -moz-linear-gradient(top, transparent, transparent);
background-image: -ms-linear-gradient(top, transparent, transparent);
background-image: -o-linear-gradient(top, transparent, transparent);
background-image: -webkit-gradient(linear, center top, center bottom, from(transparent), to(transparent));
background-image: -webkit-linear-gradient(top, transparent, transparent);
background-image: linear-gradient(top, transparent, transparent);
background-image: linear-gradient(to bottom, transparent, transparent);
-moz-background-clip: padding;
background-clip: padding-box;
-webkit-background-clip: padding-box;
font-family: calibri 14px;
}Topic: Angular 2 jqxbutton
I have two issues when working with a button.
1. I can disable the button through properties and button class changes and disable=true but button responsive to mouse click.
2. I can not get cursor set to pointer. I believe this is inheritance issue with css classes. I have Bootstrap 3.3.7 loaded first and it sets cursor to pointer for role=button. Then jqx-button class resets cursor to default. If I change default to pointer it works through browser development function.
I’m using chrome browser.
Below is Angular 2 component.
/// <reference path=”../vendor/jqwidgets-ts/jqwidgets.d.ts” />
import {Component, ViewChild, AfterViewChecked, ViewEncapsulation, DoCheck, ViewContainerRef} from ‘@angular/core’;import {Overlay, overlayConfigFactory} from ‘angular2-modal’;
import {Modal, BSModalContext} from ‘angular2-modal/plugins/bootstrap’;import {jqxGridComponent} from ‘../vendor/jqwidgets-ts/angular_jqxgrid’;
import {jqxButtonComponent} from ‘../vendor/jqwidgets-ts/angular_jqxbutton’;
import {jqxNotificationComponent} from ‘../vendor/jqwidgets-ts/angular_jqxnotification’;import {LogService} from “./log.service”;
@Component({
selector: ‘my-grid’,
template: `<span defaultOverlayTarget></span>
{{AccountName}}
<angularGrid (OnRowclick)=”OnRowclick($event)”></angularGrid>
<div>
<angularButton (OnClick)=”onDelete()”></angularButton>
</div>
<angularNotification>
<div> Account has been succesfuly deleted.</div>
</angularNotification>
`,
directives: [jqxGridComponent, jqxButtonComponent, jqxNotificationComponent],
providers: [Modal]
})
export class GridComponent implements AfterViewChecked, DoCheck {
AccountName: string = ”;
RowIndex: number = 0;
TotalRows: number = 0;
MessageNotification: string = ”;
@ViewChild(jqxGridComponent) myGrid: jqxGridComponent;
@ViewChild(jqxButtonComponent) deleteButton: jqxButtonComponent;
@ViewChild(jqxNotificationComponent) msgNotification: jqxNotificationComponent;
settings: jqwidgets.GridOptions;
deleteButtonSettings: jqwidgets.ButtonOptions;
msgNotificationSettings: jqwidgets.NotificationOptions;
flag: Boolean = false;url = “../vendor/data/accounts.json”;
source =
{
datatype: “json”,
datafields: [
{name: ‘AcctName’, type: ‘string’},
{name: ‘AcctCategory’, type: ‘string’},
{name: ‘AcctType’, type: ‘string’},
{name: ‘AcctNumber’, type: ‘string’},
{name: ‘AcctOpenDate’, type: ‘date’},
{name: ‘AcctDescription’, type: ‘string’},
{name: ‘AcctBalance’, type: ‘int’},
{name: ‘AcctStatus’, type: ‘bool’}
],
url: this.url
};dataAdapter = new $.jqx.dataAdapter(this.source, {
downloadComplete: function (data, status, xhr) {
},
loadComplete: function (data) {
},
loadError: function (xhr, status, error) {
}
});constructor(private logService: LogService, public modal: Modal) {
this.settings = {
width: ‘100%’,
source: this.dataAdapter,
pageable: false,
autoheight: true,
sortable: true,
altrows: false,
theme: ‘energyblue’,
selectionmode: ‘none’,
enabletooltips: true,
editable: false,
columns: [
{
text: ‘Name’,
datafield: ‘AcctName’,
width: ‘20%’
},
{
text: ‘Description’,
datafield: ‘AcctDescription’,
align: ‘left’,
cellsalign: ‘left’,
width: ‘20%’
},
{
text: ‘Category’,
datafield: ‘AcctCategory’,
cellsalign: ‘left’,
align: ‘left’,
width: ‘10%’
},
{
text: ‘Type’,
datafield: ‘AcctType’,
align: ‘left’,
cellsalign: ‘left’,
width: ‘10%’
},
{
text: ‘Number’,
datafield: ‘AcctNumber’,
align: ‘left’,
cellsalign: ‘left’,
width: ‘10%’
},
{
text: ‘Open Date’,
datafield: ‘AcctOpenDate’,
align: ‘left’,
cellsalign: ‘left’,
cellsformat: ‘MM/dd/yyyy’,
width: ‘10%’
},
{
text: ‘Balance’,
datafield: ‘AcctBalance’,
align: ‘center’,
cellsalign: ‘right’,
cellsformat: ‘d2’,
width: ‘10%’
},
{
text: ‘Status Active ?’,
datafield: ‘AcctStatus’,
align: ‘center’,
cellsalign: ‘center’,
columntype: ‘checkbox’,
width: ‘10%’
},
],
columngroups: [
{text: ‘Product Details’, align: ‘center’, name: ‘ProductDetails’}
]
};this.deleteButtonSettings = {
width: 100,
height: 25,
theme: ‘energyblue’,
value: ‘Delete’,
disabled: false,
textImageRelation: “imageBeforeText”,
textPosition: “left”,
imgSrc: “../vendor/jqwidgets/styles/images/close.png”
};this.msgNotificationSettings = {
width: 350, position: “bottom-right”, opacity: 0.9,
autoOpen: false, animationOpenDelay: 800,
autoClose: true, autoCloseDelay: 3000,
template: “success”
};
}ngDoCheck() {
this.logService.pushedData.subscribe(
data => {
this.AccountName = data.SelectedAccount;
this.RowIndex = data.SelectedRowIndex;
this.TotalRows = data.TotalRows;
}
);
}setRow(): void {
this.myGrid.selectrow(this.RowIndex);}
public ngAfterViewChecked(): void {
if (this.flag === false) {
var self = this;
self.Initialize();
}
this.myGrid.clearselection();
this.myGrid.selectrow(this.RowIndex);
this.flag = true;
}Initialize(): void {
this.myGrid.createWidget(this.settings);
this.deleteButton.createWidget(this.deleteButtonSettings);
this.msgNotification.createWidget(this.msgNotificationSettings);}
onDelete(): void {
var selectedrowindex = this.myGrid.getselectedrowindex();
//var rowscount = this.myGrid.getdatainformation.rowscount;
var id = this.myGrid.getrowid(selectedrowindex);var data = this.myGrid.getrowdata(selectedrowindex);
//alert(data.AcctName + ” ” + data.AcctBalance);this.modal.confirm()
.size(‘lg’)
.isBlocking(true)
.showClose(true)
.keyboard(27)
.titleHtml(‘<h4>Delete Account?</h4>’)
.body(‘Select the “<strong class=”alert-success”>Yes” button to delete or the “<strong class=”alert-danger”>No” button to cancel.’)
.okBtn(‘Yes’)
.okBtnClass(‘btn btn-success’)
.cancelBtn(‘No’)
.cancelBtnClass(‘btn btn-danger’)
.open()
.catch(err => alert(“ERROR”)) // catch error not related to the result (modal open…)
.then(dialog => dialog.result) // dialog has more properties,lets just return the promise for a result.
.then(result => {this.myGrid.deleterow(id);
this.MessageNotification = ‘Account has been delete.’;
this.msgNotification.open();
}
) // if were here ok was clicked.
.catch(err => {
}) // if were here it was cancelled (click or non block click)
;
}OnRowclick(event): void {
console.log(‘Row click’);
var datainformation = this.myGrid.getdatainformation();
var rowscount = datainformation.rowscount;
alert(rowscount);var args = event.args;
// // row’s bound index.
var rowBoundIndex = args.rowindex;
this.RowIndex = args.rowindex;
this.myGrid.clearselection();
this.myGrid.selectrow(rowBoundIndex);
}OnRowselect(event): void {
console.log(‘Row Select’);
}
}