jQWidgets Forums
Forum Replies Created
-
Author
-
Here is a simple PDF Report example if anyone would like it using fpdf…. If anyone like I will provide a working example link…
Called from a button on the grid….
var pdfButton = $(““);
pdfButton.find(‘span’).addClass(‘ui-icon ui-icon-print’);
pdfButton.width(16);
pdfButton.jqxTooltip({content: ‘PDF Report!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme});
pdfButton.appendTo(tableLeft);pdfButton.click(function (event) {
$(“#message”).html(“PDF Report”);
window.open(“../CompanyTab/CompanyReport.php”);
});SetCreator ( “Creator” );
$pdf->SetAuthor ( $_SESSION[ ‘UserName’ ] );
$pdf->SetKeywords ( ‘Company Report ‘ . date ( “Y/m/d H:i” ) );
$pdf->SetSubject ( “Company PDF Report” );
$pdf->setTitle ( ‘Company Report’ );
$pdf->setPageWidth ( 334 );
$pdf->AliasNbPages ();
$pdf->DataColumns ( $conn, $meta );
$pdf->Data ( $conn, $sql );
$pdf->SetFont ( ‘Arial’, ”, 7 );
$pdf->AddPage ();
$pdf->DataTable ();
$pdf->Output ();?>
Can you tell me a supported way during the updaterow I can get the ColumnName that was changed. I do not want to update the complete record for one cell….
I am using a little different update than normal because I update each cell as changed, not the complete record. To do this I need the RecordID , columnName and columnValue which I get from the rowid, args.datafield and args.value. If you test this it works and I got this information from someone jqWidgets. If there is a better way let me know and I will change my approach.
updaterow: function (rowid, rowdata, commit) {
var updateID = rowid;
var updateColumn = args.datafield;
var updateValue = args.value;
alert(updateID + ‘ ‘ + updateColumn + ‘ ‘ + updateValue);
//$.getScript(“../javascript/gridPDOUpdateRow.js”, function(){ gridUpdateRow(jqxgrid, rowid, updateID, updateColumn, updateValue, valueSelected, rowdata, commit, source.url); });
},I guess the real question I should have asked is when using setcellvalue does it work the same as if you edited a cell’s value? If not is there a way to pass the commit=true or a way to have setcellvalue uses my a custom function?
June 24, 2013 at 4:10 pm in reply to: bindingcomplete jqxGrid('focus'); bindingcomplete jqxGrid('focus'); #23767Ok this is working for page end, home, up and down keys but not cursor keys. I am assuming that there needs to be another step to actually use the cursor keys…. Is that correct?
June 24, 2013 at 3:51 pm in reply to: bindingcomplete jqxGrid('focus'); bindingcomplete jqxGrid('focus'); #23765Seems simple, but I must be missing something….
$(jqxgrid).on(“bindingcomplete”, function (event) {
$(jqxgrid).jqxGrid(‘focus’);
});$(jqxgrid).jqxGrid({
theme: theme,
width: ‘99.9%’,
height: 800,
source: dataAdapter,
scrollbarsize: 10,
sortable: true,
sorttogglestates: 1,
altrows: true,
pageable: true,
pagesize: 28,
columns: [
{text: ‘ID’, dataField: ‘ID’, width: 60, pinned: true, hidden: false, editable: false, filterable: false},
{text: ‘Category’, dataField: ‘Category’, width: 100, editable: true},
{text: ‘Message’, dataField: ‘Message’, width: 600, editable: false},
{text: ‘Notes’, dataField: ‘Notes’, width: 400, editable: true},
{text: ‘Created’, dataField: ‘Created’, width: 160, editable: false, filterable: false},
{text: ‘CreatedBy’, dataField: ‘CreatedBy’, width: 160, editable: false},
{text: ‘Updated’, dataField: ‘Updated’, width: 160, editable: false, filterable: false},
{text: ‘UpdatedBy’, dataField: ‘UpdatedBy’, width: 160, editable: false, filterable: true},
{text: ”, dataField: ”, width: ‘100%’, editable: false, filterable: false}
]
});June 24, 2013 at 3:31 pm in reply to: bindingcomplete jqxGrid('focus'); bindingcomplete jqxGrid('focus'); #23762Not sure I know if I bind before or after. How do I tell?
June 17, 2013 at 6:04 pm in reply to: Grid source Custom Function Grid source Custom Function #23277I 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 {
}
June 17, 2013 at 3:54 pm in reply to: Grid source Custom Function Grid source Custom Function #23274Is there some documentation you could point me to on this subject?
June 5, 2013 at 3:10 pm in reply to: How can I trigger the loader.gif How can I trigger the loader.gif #22641Thanks, I figured it out…
$(jqxgrid).jqxGrid({ showdefaultloadelement: true});
June 3, 2013 at 5:09 pm in reply to: Is there a way to iterate through a grid Is there a way to iterate through a grid #22456Can anyone point me to some documentation that might help iterate through a grid? Trying to build an CSV to database import app.
May 9, 2013 at 9:12 pm in reply to: Export using local server example Export using local server example #20869Can you please help me understand what I am doing wrong. I need all records exported to csv.
$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, ‘Application’, true, ,true, ‘http://192.168.1.10/jqw/save-file.php’);
May 7, 2013 at 6:33 pm in reply to: Cell Rendering issue with Cell Formatting Cell Rendering issue with Cell Formatting #20693Here is your example modified. The format is not correct….
Grid with custom cells rendering.
$(document).ready(function () {
// prepare the data
var data = new Array();
var firstNames =
[
“Andrew”, “Nancy”, “Shelley”, “Regina”, “Yoshi”, “Antoni”, “Mayumi”, “Ian”, “Peter”, “Lars”, “Petra”, “Martin”, “Sven”, “Elio”, “Beate”, “Cheryl”, “Michael”, “Guylene”
];
var lastNames =
[
“Fuller”, “Davolio”, “Burke”, “Murphy”, “Nagase”, “Saavedra”, “Ohno”, “Devling”, “Wilson”, “Peterson”, “Winkler”, “Bein”, “Petersen”, “Rossi”, “Vileid”, “Saylor”, “Bjorn”, “Nodier”
];
var productNames =
[
“Black Tea”, “Green Tea”, “Caffe Espresso”, “Doubleshot Espresso”, “Caffe Latte”, “White Chocolate Mocha”, “Cramel Latte”, “Caffe Americano”, “Cappuccino”, “Espresso Truffle”, “Espresso con Panna”, “Peppermint Mocha Twist”
];
var priceValues =
[
“2.25”, “1.5”, “3.0”, “3.3”, “4.5”, “3.6”, “3.8”, “2.5”, “5.0”, “1.75”, “3.25”, “4.0”
];
for (var i = 0; i < 100; i++) {
var row = {};
var productindex = Math.floor(Math.random() * productNames.length);
var price = parseFloat(priceValues[productindex]);
var quantity = 1 + Math.round(Math.random() * 10);
row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
row["productname"] = productNames[productindex];
row["price"] = price;
row["quantity"] = quantity;
row["total"] = price * quantity;
data[i] = row;
}
var source =
{
localdata: data,
datatype: "array"
};
var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
if (value < 20) {
return '‘ + value + ”;
}
else {
return ‘‘ + value + ‘‘;
}
}var cellsrendererTotal = function (row, columnfield, value, defaulthtml, columnproperties) {
if (value < 20.00) {
return '‘ + value + ”;
}
else {
return ‘‘ + value + ‘‘;
}
}$(“#jqxgrid”).jqxGrid(
{
width: 670,
source: source,
pageable: true,
autoheight: true,
columns: [
{ text: ‘First Name’, datafield: ‘firstname’, width: 100 },
{ text: ‘Last Name’, datafield: ‘lastname’, width: 100 },
{ text: ‘Product’, datafield: ‘productname’, width: 180 },
{ text: ‘Quantity’, datafield: ‘quantity’, width: 80, cellsalign: ‘right’, cellsformat: ‘f2’, cellsrenderer: cellsrenderer },
{ text: ‘Unit Price’, datafield: ‘price’, width: 90, cellsalign: ‘right’, cellsformat: ‘c2’, cellsrenderer: cellsrenderer },
{ text: ‘Total’, datafield: ‘total’, cellsalign: ‘right’, cellsformat: ‘c2’, cellsrenderer: cellsrendererTotal }
]
});
});Here are the deprecated extensions. They also suggest moving to PDOStatments which I have completely.
mysql_query()
mysql_fetch_assoc()
mysql_num_rows()
*******
http://php.net/manual/en/function.mysql-num-rows.php
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include:mysqli_stmt_num_rows()
PDOStatement::rowCount()********
The area I am having problems with are paging. Here is a small example. My problem seem to be pager callback if I am understanding everything. When clicking on the Previous Next buttons the callback is not triggered. I have tested the php by entering static variables to test each area.
pager: function(pagenum, pagesize) {
alert(pagenum + ‘ ‘ + pagesize);
//$(jqxgrid).jqxGrid(‘updatebounddata’, pagenum, pagesize, oldpagenum);
},0) {
$pagenum = $_GET[‘pagenum’];
}if (isset($_GET[‘pagesize’]) && $_GET[‘pagesize’] > 0) {
$pagesize = $_GET[‘pagesize’];
}$start = $pagenum * $pagesize;
$table = “ProductLarge”;
$sql = “SELECT ID, Product, Description, Cost, Markup FROM $table LIMIT $start, $pagesize”;if (isset($_GET[‘insert’])) {
} else if (isset($_GET[‘update’])) {
} else if (isset($_GET[‘delete’])) {
} else if (isset($_GET[‘sortdatafield’])) {
$sortfield = $_GET[‘sortdatafield’];
$sortorder = $_GET[‘sortorder’];if ($sortfield != NULL) {
if ($sortorder == “desc”) {
$query = $sql . ” ORDER BY $sortfield DESC”;
} else if ($sortorder == “asc”) {
$query = $sql . ” ORDER BY $sortfield ASC”;
}
$preparedStatement = $conn->prepare($query);
if ($preparedStatement->execute()) {
$result = $preparedStatement->fetchAll();
echo json_encode($result);
} else {
$results = array(“Success” => “false”, “Error” => “true”, “Message” => “Query Failed! “);
die(json_encode($results));
}
}
} else {
$query = $sql;
$preparedStatement = $conn->prepare($query);
if ($preparedStatement->execute()) {
$count = $preparedStatement->rowCount();
$result = $preparedStatement->fetchAll();
$data[] = array(
‘TotalRows’ => $count,
‘Rows’ => $result
);
echo json_encode($data);
} else {
$results = array(“Success” => “false”, “Error” => “true”, “Message” => “Query Failed! $query”);
die(json_encode($results));
}
}
?>$(document).ready(function() {
var theme = “energyblue”;
var jqxgrid = “#jqxgridProductLarge”;var source = {
datatype: “json”,
cache: false,
datafields: [
{name: ‘ID’, type: ‘int’},
{name: ‘Product’, type: ‘text’},
{name: ‘Description’, type: ‘text’},
{name: ‘Cost’, type: ‘float’},
{name: ‘Markup’, type: ‘float’},
{name: ”}//Place holder
],
id: ‘ID’,
url: ‘ProductLargeData.php’,
root: ‘Rows’,
beforeprocessing: function(data) {
source.totalrecords = data[0].TotalRows;
},
addrow: function(rowid, commit) {},
deleterow: function(rowid, commit) {},
updaterow: function(rowid, rowdata, commit) {},
filter: function(filters, recordsArray) {
//alert(filters + ‘ ‘ + recordsArray);
},
//pagenum: 3,
//pagesize: 20,
pager: function(pagenum, pagesize) {
alert(pagenum + ‘ ‘ + pagesize);
//$(jqxgrid).jqxGrid(‘updatebounddata’, pagenum, pagesize, oldpagenum);
},
sort: function(column, direction) {
//$(jqxgrid).jqxGrid(‘updatebounddata’, ‘sort’);
}
};var dataAdapter = new $.jqx.dataAdapter(source);
$(jqxgrid).jqxGrid({
theme: theme,
width: ‘99.9%’,
//height: 500,
source: dataAdapter,
pageable: true,
pagesize: 20,
showemptyrow: false,
autoheight: true,
virtualmode: true,
scrollbarsize: 10,
sortable: true,
sorttogglestates: 1,
altrows: true,
enablehover: true,
editable: true,
filterable: true,
selectionmode: “multiplecellsadvanced”,
rendergridrows: function(params) {
return params.data;
},
columns: [
{text: ‘ID’, dataField: ‘ID’, width: 60, pinned: true, editable: false},
{text: ‘Product’, datafield: ‘Product’, width: 180, editable: false},
{text: ‘Description’, dataField: ‘Description’, width: 500, editable: false},
{text: ‘Cost’, dataField: ‘Cost’, width: 160, editable: false},
{text: ‘Markup’, dataField: ‘Markup’, width: 160, editable: false},
{text: ”, dataField: ”, width: ‘100%’, editable: false}
]
});
});April 18, 2013 at 3:56 pm in reply to: Export using local server example Export using local server example #19561Marco thanks, but does not work. If you leave anything out it goes to the JQWidgets server.
By the documentation I can’t tell if null is something like this (Which goes to the JQWidgets server and gives me column headings)
$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, jqxgrid, true, true, ‘http://192.168.1.10’);Things I have tried…
$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, jqxgrid, true, ”, true, ‘http://192.168.1.10’);$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, jqxgrid, true, “”, true, ‘http://192.168.1.10’);
$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, jqxgrid, true, true, ‘http://192.168.1.10’);
$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, jqxgrid, true, null, true, ‘http://192.168.1.10’);
Seems like an example in the document page would help define what they mean as null…
I know I don’t want my data going to their site….
April 18, 2013 at 3:15 pm in reply to: Export using local server example Export using local server example #19556I seem to having an issue with the fourth parameter. When you say Set null for all rows, do you mean ”?
The fourth parameter is optional and determines the array of rows to be exported. By default all rows are exported. Set null, if you want all rows to be exported.
$(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, ‘jqxgrid’, true, ” ,true,’http://192.168.1.10′);
-
AuthorPosts