I have to send an email, with kendo ui grid data as attachment. If I use excel export the I am not able to auto save the file in project folder at particular location. I am not able to customize the saveAsExcel() method.
So I don't want to save that file in the local folder. Is there any way to do this?
I am not able to auto download the file to specific folder in project. Every time it is asking to save at particular location.
I am trying to auto save the file to specific folder in project and try to attach that file in email.
I am not getting any data in excel while saving grid. Also I want to avoid the save as popup for saving the file.
var grid = $("#MyReport").data("kendoGrid");
var trs = $("#MyReport").find('tr');
var rows = [];
for (var i = 0; i < trs.length; i++) {
var dataItem = grid.dataItem(trs[i]);
rows.push({
cells: [
dataItem
]
})
}
var workbook = new kendo.ooxml.Workbook({
sheets: [
{ title: "EmployeeInfo",
rows: rows
}
]
});
kendo.saveAs({ dataURI: workbook.toDataURL(), fileName: "EmployeeInfo.xlsx" });
}
You are on wrong track. In real case scenario, your project should be on server. When a user clicks export on your grid it will be prompted to save on his local computer not in your project on server. Kendo export is client-side export. You need to export on the server-side, save the file on the server and attache it when sending mail through your project.
Steps to take:
On export button click send params page_size and page
On server-side with that params get data from a database
On server-side with data from a database create a file (excel)
On server-side via mail client attache created file and send it
Related
i'm trying to implement a custom upload using the #progress/kendo-react-upload component
the upload should insert some metadata in the db morovere uploading the file, so i wouldn't use the saveUrl and removeUrl but to call the server during the adding e removing events
the Upload component has these properties:
<Upload
autoUpload={false}
onRemove={onRemove}
onStatusChange={onStatusChange}
defaultFiles={files}
/>
autoupload=false, because the file shouldn't be uploaded automatically when selected but when the upload button is pressed
in defaultFiles there are previously uploaded files that i want to show in the list (to permit the user to deleted these files from the server eventually, these file are correctly identified into the event onRemove)
const onRemove = (event: any) => {
const fileToRemove = event.affectedFiles;
//...call the server to remove (removing the file and its metadata in the db)
};
new selected files are correctly listed in the:
const onStatusChange = (event: UploadOnStatusChangeEvent) => {
const readyToUpload = event.affectedFiles.filter(
(item: UploadFileInfo) => item.status == UploadFileStatus.Uploading
);
//...call the server to upload the file and add some metadata into a databae
};
how to prevent that saveUrl and removeUrl are automatically invoked when thes files are added or removed from the component and to manage the upload in the corresponding events
I want to create a button on a purchase order form to download in one file all the different item lines in a csv file.
I created a suitlet file and a user event script.
The user event script create a button that redirect on the url of my suitlet script to execute a function.
For now a create a file csv in a folder, but I don't know how redirect on the file url or to directly download the file
Load the file, get the url property (it's not a link to the NS record/file it's a download link), open the url.
In SuiteScript 1.0
var file = nlapiLoadFile('file_id');
var url = "https://system.netsuite.com" + file.getURL();
window.open(url, '_blank');
In SuiteScript 2.0
var filePath = file.load({
id: 'Images/Desert.jpg'
});
var url = file.url;
window.open(url, '_blank');
I have a kendo grid, in which I have selected filter on one column, I am reloading the grid, I want the same filter to be there when grid reloads.
I am using the below code to reload the grid. It works, but it doesn't show the selected filter item checked. I checked IDR in the filter then reloaded the page, it shows 1 item selected but doesn't show IDR as checked.
function ReloadGrid() {
var grid = $('#gridId').data('kendoGrid');
grid.dataSource.read();
grid.setDataSource(grid.dataSource);
}
Well there is two way to achieve this.
One way is to save filters in database and second one is to use local storage as mentioned in comment.
I prefer second one, using local storage to save filters and load it upon read.
#GaloisGirl is pointing you in right direction.
Check this example again: Persist state
Basic usage of locale storage is to save some data under some name (key,value):
let person = {
name: 'foo',
lastName: 'bar'
};
let save = function (person) {
let personString = JSON.stringify(person);
localStorage.setItem('person', personString);
console.log('Storing person: ', personString);
};
let load = function () {
let personString = localStorage.getItem('person'); // <----string
let person = JSON.parse(personString); // <----object
console.log('Stored person: ', person);
};
let remove = function (name) {
localStorage.removeItem(name);
console.log('Removed from local storage!');
};
save(person);
load();
remove(person.name);
In kendo world you need to save current options state of grid in local storage, you can achieve that by adding button like in example or on the fly with change or with window.onbeforeunload or like in your example beforen reload grid.
You can check saved data under application tab in browsers, eg. chrome:
Hope it helps, gl!
Purpose
I am trying to make a common answer database for a website form. The form is a description of computer hardware specifications, and I am trying to make it so that based on a model field, other fields are filled in automatically. The extension with have two buttons, "populate" which will based on the model field, check the database for a matching entry, and then populate data into the forms based on that. The second button being "save", which will take data in the fields and marry it to the model field and place it into the database.
Question
So, my main question is on interacting with the webpage itself, how do I grab data from the webpage, and then how do I make changes to fields?
So, my main question is on interacting with the webpage itself, how do I grab data from the webpage, and then how do I make changes to fields?
You can do this with a Firefox Add-on SDK Page-mod, click here for the documentation
Here is an example for getting data:
Example Page-Mod
/lib/main.js:
var tag = "p";
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.mozilla.org",
contentScriptFile: data.url("element-getter.js"),
onAttach: function(worker) {
worker.port.emit("getElements", tag);
worker.port.on("gotElement", function(elementContent) {
console.log(elementContent);
});
}
});
/data/element-getter.js:
self.port.on("getElements", function(tag) {
var elements = document.getElementsByTagName(tag);
for (var i = 0; i < elements.length; i++) {
self.port.emit("gotElement", elements[i].innerHTML);
}
});
I am using jqGrid to display values on the client side. Initially the grid is empty and the user enters the data inline. According to the requirement, I need to submit the data once the user submits the form.
I intend to, just prior to submitting the form, format contents so that I can store the user entered details in the database. Is their any way I can get a grid data in the form of JSON?
Currently I am doing the same in the following way:
var ids = $(gridId).jqGrid('getDataIDs');
for ( var i =1; i <=ids.length; i++) {
var id = ids[i];
rowData = $("#"+grid).jqGrid('getRowData',id);
}
//add rowData to some global object and inturn to some hidden field and sending it the server.
Is there any other way to do the same?
I would recommend you to use
var gridData=$("#list").jqGrid('getGridParam','data');
to get full data from the grid. After you have all the data in one JavaScript object gridData you can modify it in the way which you need prior to submitting to the server.