require-config: Uncaught Error: Script error for: datatables.net - requirejs

I am working on making and formatting tables using JS, datatables.net website.
and I make table successfully , and included file easily.
but now I need to add a button on top which is used to download csv format of a table data. but its not working for me and providing below error.
Uncaught Error: Script error for: datatables.net
require([
'jquery',
'mage/mage',
'jquery/ui',
'A2bizz_Custom/js/jquery.dataTables.min',
'A2bizz_Custom/js/dataTables.buttons.min'], function($){
var table = $('#a2bizz_custom').DataTable({
dom: 'B',
buttons: ['csv']
});
});
I am able to add datatable using jquery.dataTables.min but When including second js dataTables.buttons.min , then I a getting above error.
Looking for helping hand.
thanks

Related

Electron NodeJS Ag-Grid Cannot Import

In render.js I have
import { Grid } from 'ag-grid-community';
import { tableMethods } from './table.js';
I created my own custom table methods and decided to try ag-grid since mine aren't as fast as theirs (no surprise). Unfortunately, while I could get my own methods loading from my js file by setting
<script type="module" src="render.js"></script>
I cannot get ag-grid to load, I get this error
Uncaught TypeError: Failed to resolve module specifier "ag-grid-community". Relative references must start with either "/", "./", or "../".
I used npm i ag-grid-community -D to install it. I wasn't sure if I needed the -D, so I tried without that and it still shows same error.
*Note - of course I've tried doing what the error message says. But it didn't resolve and the documentation doesn't mention anything about this.
I was able to get this working by adding following before my render.js file
<script src="ag-grid-community.js"></script>
I also disabled type=module once I realized this is probably the intended way to split up rendering scripts, or at least that was my guess.

How to write an html from a remote function using writeDump or writeOutput?

I am coming from Adobe Coldfusion and I'm trying to debug a component in Lucee by writing values to the output. Normally what I do is:
component Sample {
remote Void function spotCheck() {
writeDump(1234);
writeOutput("<br>Test");
return
}
Then hit the page to HTTP://localhost/sample/Sample.cfc?method=spotCheck
But it does not work. I updated the function to have a returnformat="text", but then the output is plain text with HTML tags in its text form. I tried setting it to "html" instead of text but then I get the error below:
This page contains the following errors:
error on line 20 at column 17: xmlParseEntityRef: no name
Below is a rendering of the page up to the first error.
I'm probably doing it the wrong way and I'm happy to learn the Lucee way of how to easily inspect values of variables inside a component function.
PS: I don't have/use step by step debugger.

How do I init XOD in WebViewer? "DisplayModes" is undefined

I'm trying to load a XOD document into a PDFTron WebViewer. As far as I can read in the documentation and samples, this should be a simple "plug and play"-operation - it should simply work when you point at a file. Ideally, in my example, the document should be fetched from a service, as so:
fetch('/myservice/GetXOD')
.then(function(data) {
$(function() {
var viewerElement = document.getElementById("viewer");
var myWebViewer = new PDFTron.WebViewer({
initialDoc: data.body
}, viewerElement);
});
});
Unfortunately I get the following error:
Uncaught TypeError: Cannot read property 'DisplayModes' of undefined
The reason I'm doing it in a fetch, is because I'm rendering a Handlebars template, and pass the data to instantiate in a callback. However, I've isolated the code into an otherwise "empty" HTML-document, and in the simplified example below, I'm simply pointing at the XOD provided by PDFTron on page load (no fetch this time).
$(function() {
var viewerElement = document.getElementById("viewer");
var myWebViewer = new PDFTron.WebViewer({
initialDoc: 'GettingStarted.xod' // Using the XOD provided by PDFTron
}, viewerElement);
});
This unfortunately returns a different error (HTTP status 416).
Uncaught Error: Error loading document: Error retrieving file: /doc/WebViewer_Developer_Guide.xod?_=-22,. Received return status 416.
The same error appears when I run the samples from PDFTron on localhost.
I'm at a complete loss of how I should debug this further - all the samples assume everything is working out of the box.
I should note that I can actually get PDFs working just fine on localhost, but not on the server. XODs are problematic both on the server and on localhost.
I'm sorry to hear you are having troubles running our samples.
Your error message says 416 which means "Requested range not satisfiable". Perhaps your development servers do not support byte range requests (https://en.wikipedia.org/wiki/Byte_serving).
Could you try passing an option streaming: true? When streaming is true you're just requesting the entire file up front which shouldn't be a problem for any servers but it is a problem for WebViewer if the file is large because it will need to be completely downloaded and parsed at the start which is slow.

Display only the individual error message using validation Engine

Iam using jQuery Validation engine in my Asp.net MVC application. I would like to show individual error messages.Now it showing both the individual error message and also summary at the bottom. So it would be really helpful to know how can I display only the individual error messages rather than both .
In my popup script where fancybox is loaded ie
$("a.create-report").fancybox(
{
'autoDimensions':true,
'centerOnScroll':true,
'padding' :'20px'
});
just added
$('#fancybox-close').click(function () {
$(".formError").remove();
});
$('#fancybox-overlay').live("click",function () {
$(".formError").remove();
});
Then the validation summary get removed

error when i try to obtain content of an iframe using javascript code as shown

I have an iframe within the main window named "test_iframe".
I want to access the content of "test_iframe" within a google chrome extension.
I am trying to access the content of this iframe, but I am getting the following error-
Uncaught TypeError: Cannot read property 'contentWindow' of null
The javascript code I have used is given below-
var htmlvar = document.getElementById('test_iframe').contentWindow.document.body.innerHTML;
What is wrong with the code? How can I make it work?
instead of test_iframe in coding try folllwing
<%=txtName.ClientID%>
i.e.
var htmlvar = document.getElementById('<%=txtName.ClientID%').contentWindow.document.body.innerHTML;

Resources