jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid source Custom Function
Tagged: filter, getfilterinformation, getsortinformation, grid, jqxgrid, sort, source
This topic contains 4 replies, has 2 voices, and was last updated by Dimitar 11 years, 9 months ago.
-
Author
-
Is there a way to add a custom function “custom” to the source of grid? I will be adding a button to call the custom function.
var source = {
datatype: “json”,
datafields: [
{name: ‘Title’, type: ‘text’},
{name: ‘FirstName’, type: ‘text’},
{name: ‘LastName’, type: ‘text’},
{name: ‘Phone’, type: ‘text’},
{name: ‘Email’, type: ‘text’},
{name: ‘Notes’, type: ‘text’},
{name: ‘Created’, type: ‘text’},
{name: ‘CreatedBy’, type: ‘text’},
{name: ‘Updated’, type: ‘text’},
{name: ‘UpdatedBy’, type: ‘text’},
{name: ”}
],
id: ‘ID’,
url: “../Employee/EmployeeData.php”,
addrow: function(rowid, commit) {
},
deleterow: function(rowid, commit) {
},
updaterow: function(rowid, rowdata, commit) {
},
sort: function() {
}
custom: function() {
doCustom() //********************
}
};Hello DavidSimmons,
Yes, you can add a custom function, the source of the grid is a JavaScript object and there is no restriction in adding functions to it.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Is there some documentation you could point me to on this subject?
I think my approach my have been wrong for what I am trying. What I need do is when a button is pressed, pass the sort Object and the Filter Object to a url to create a report.
Can you tell what the sort and filter objects are I need to pass or is there a better way to do this?
Button
var ReportButton = $(““);
ReportButton.find(‘span’).addClass(‘ui-icon ui-icon-print’);
ReportButton.width(16);
ReportButton.jqxTooltip({content: ‘Report!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme});
ReportButton.appendTo(tableLeft);ReportButton.click(function (event) {
******* pass sort Object and filter object *******
});
Data
if (isset($_GET[‘insert’])) {} else if (isset($_GET[‘update’])) {
} else if (isset($_GET[‘delete’])) {
} else if (isset($_GET[‘report’])) {
********* Report Do Something *********
Server side Filtering
Server side sorting***********************************
} else if (isset($_GET[‘sortdatafield’])) {} else {
}
Hi DavidSimmons,
The methods getsortinformation and getfilterinformation return information about the current sorting and filtering and may be useful in your solution.
On a side note, please format your code in the future by selecting it and pressing the { } icon from the toolbar.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.