Parameters:
Name |
Type |
Description |
config |
Object
|
Properties
Name |
Type |
Description |
headerMenu |
Boolean
|
Show menu on each column heading. |
highlightRecord |
Boolean
|
True to highlight rows on click, default: true |
mouseOverEffect |
Boolean
|
True to highlight rows on mouse over, default: true. |
columns |
Object
|
Description of columns. See example below for details. |
emptyText |
Object
|
Text to show on grid when there are no data, default: "No data" |
|
- Source:
-
Fires:
- ludo.grid.Grid#click Row clicked. Arguments: 1) The record, i.e. JSON Object, example: { "firstname": "Jane", "lastname": "Johnson" } and 2) name of clicked column,event: example: "lastname"
- ludo.grid.Grid#dblclick Row double clicked. Arguments: 1) The record, i.e. JSON Object, example: { "firstname": "Jane", "lastname": "Johnson" } and 2) name of clicked column,event: example: "lastname"
Examples
children:[
..
{
id:'myGrid',
type:'grid.Grid',
stateful:true,
resizable:false,
columns:{
'country':{
heading:'Country',
removable:false,
sortable:true,
movable:true,
width:200,
renderer:function (val) {
return '<span style="color:blue">' + val + '</span>';
}
},
'capital':{
heading:'Capital',
sortable:true,
removable:true,
movable:true,
width:150
},
population:{
heading:'Population',
movable:true,
removable:true
}
},
dataSource:{
url:'data-source/grid.php',
id:'myDataSource',
paging:{
size:12,
remotePaging:false,
cache:false,
cacheTimeout:1000
},
searchConfig:{
index:['capital', 'country']
},
listeners:{
select:function (record) {
console.log(record)
},
count:function(countRecords){
ludo.get('gridWindowSearchable').setTitle('Grid - capital and population - Stateful (' + countRecords + ' records)');
}
}
}
}
...
]
Is example of code used to add a grid as child view of another view. You may also create the grid directly using:
new ludo.grid.Grid({...})
where {...} can be the same code as above. use the "renderTo" config property to specify where you want the grid to be rendered.