1
Help for ParamQuery Pro / Re: Set color and background-color of selected row
« on: April 13, 2016, 04:48:23 pm »
Perfect.
Thank you
Thank you
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
selectionModel:{
type: 'row',
mode: 'single'
}
$(function () {
var data = [
{ rank: 1, company: 'Exxon Mobil', revenues: '339,938.0', profits: '36,130.0' },
{ rank: 2, company: 'Wal-Mart Stores', revenues: '315,654.0', profits: '11,231.0' },
{ rank: 3, company: 'Royal Dutch Shell', revenues: '306,731.0', profits: '25,311.0' },
{ rank: 4, company: 'BP', revenues: '267,600.0', profits: '22,341.0' },
{ rank: 5, company: 'General Motors', revenues: '192,604.0', profits: '-10,567.0' },
{ rank: 6, company: 'Chevron', revenues: '189,481.0', profits: '14,099.0' },
];
var obj = {
scrollModel: { autoFit: true },
height: 400,
editable: false,
title: "No selections",
minWidth: 30,
colModel:
[
{ title: "Rank", width: 100, dataType: "integer", dataIndx: "rank" },
{ title: "Company", width: 240, dataType: "string", dataIndx: "company" },
{ title: "Revenues ($ millions)", width: 180, dataType: "float", align: "right", dataIndx: "revenues" },
{ title: "Profits ($ millions)", width: 180, dataType: "float", align: "right", dataIndx: "profits" }
],
dataModel: {
data: data,
location: "local",
sorting: "local",
sortIndx: "profits",
sortDir: "down"
},
selectionModel:{
type: 'row',
mode: 'single'
}
}
var $grid = $("#grid_rowhover").pqGrid(obj);
});
render: function( ui ){ var dt = ui.text; return dt.substring(0,8); }
render: function( ui ){ ui.text.substring(0,8); }
render: function( ui ){ ui.text; }
orrender: function( ui ){ var dt = 'abcd1234567890'; return dt.substring(0,4)+':'+dt.substring(4,8); }
$(function () {
var data = [[1, 'Exxon Mobil', '20160219.001', '339,938.0', '36,130.0'],
[2, 'Wal-Mart Stores', '20160210.002', '315,654.0', '11,231.0'],
[39, 'Royal Dutch Shell', '20160210.001', '306,731.0', '25,311.0'],
[19, 'Crédit Agricole', '20160213.001', '110,764.6', '7,434.3'],
[20, 'American Intl. Group', '20160228.001', '108,905.0', '10,477.0']];
var obj = {
scrollModel: {autoFit: true},
height: 400,
colModel: [
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 200, dataType: "string"},
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ return ui.rowData[2].substring(0,4); } },
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ var dtx = ui.rowData[ui.rowData.rowIndx]; return dtx.substring(0,4); } },
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ return ui.rowData[ui.rowData.rowIndx].substring(0,4); } },
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ return ui.rowData[ui.rowData.rowIndx].substr(0,4) } }, //ERROR ->
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ var dt = 'abcd1234567890'; return dt.substring(0,4)+':'+dt.substring(4,8); } },
{ title: "Date", width: 100, dataType: "string", render: function( ui ){ var dt = ui.text; return dt.substring(0,4)+':'+dt.substring(4,8); } },
{ title: "Revenues ($ millions)", width: 180, dataType: "float" },
{ title: "Profits ($ millions)", width: 180, dataType: "float" }
],
dataModel: {
data: data,
sortIndx: 1,
sortDir: "up"
}
};
$("#grid_custom_sorting").pqGrid(obj);
});
$(function () {
var data = [
[1, 'Exxon Mobil', '20/02/2015', '339,938.0', '36,130.0'],
[2, 'Wal-Mart Stores', '01/01/2016', '315,654.0', '11,231.0'],
[3, 'Royal Dutch Shell', '01/12/2015', '306,731.0', '25,311.0'],
[4, 'BP', '20/02/2016', '267,600.0', '22,341.0'],
[5, 'General Motors', '31/12/2016', '192,604.0', '-10,567.0'],
[11, 'ZZZ General Electric', '20/02/2017', '157,153.0', '16,353.0']
]
var obj = {
scrollModel: {autoFit: true},
height: 400,
colModel: [
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 200 },
{ title: "Date", width: 180, dataType: "date" },
{ title: "Revenues ($ millions)", width: 180, dataType: "float" },
{ title: "Profits ($ millions)", width: 180, dataType: "float" }
],
dataModel: {
data: data,
sortIndx: 2,
sortDir: "up"
}
};
$.extend($.paramquery.pqGrid.prototype.options, $.paramquery.pqGrid.regional['it']);
$.extend($.paramquery.pqPager.prototype.options, $.paramquery.pqPager.regional['it']);
$("#grid_custom_sorting").pqGrid(obj);
});
$(function () {
var data = [
{ id: 1, company: 'Exxon Mobil', revenues: '339938.0', profits: '36130.0' },
{ id: 2, company: 'Wal-Mart Stores', revenues: '315654.0', profits: '11231.0' },
{ id: 3, company: 'Royal Dutch Shell', revenues: '306731.0', profits: '25311.0' },
{ id: 4, company: 'BP', revenues: '267600.0', profits: '22341.0' },
{ id: 5, company: 'General Motors', revenues: '192604.0', profits: '-10567.0' },
{ id: 6, company: 'Chevron', revenues: '189481.0', profits: '14099.0' },
];
var obj = {
scrollModel: { autoFit: true },
height: 200,
showBottom: false,
resizable: true,
editable: false,
numberCell: { show: false },
selectionModel: { type: 'row', fireSelectChange: true },
swipeModel: { on: false }
};
obj.colModel = [
{ title: "ID", width: 100, dataType: "integer", dataIndx: "id" },
{ title: "Company", width: 200, dataType: "string", dataIndx: "company" },
{ title: "Revenues ($ millions)", width: 150, dataType: "float", align: "right", dataIndx: "revenues" },
{ title: "Profits ($ millions)", width: 150, dataType: "float", align: "right", dataIndx: "profits" }
];
obj.dataModel = {
data: data
};
obj.selectChange = function (evt, ui) {
alert( this.selection().??????? );
// $("#select_change_div").html(JSON.stringify(address));
}
var $grid = $("#grid_row_selection").pqGrid(obj);
});