JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › grid and data adapter
- This topic has 3 replies, 2 voices, and was last updated 4 years, 5 months ago by Martin.
-
AuthorPosts
-
April 29, 2020 at 10:58 am #100727adminKeymaster
Hi,
i have write in js file:
Smart(‘#timeStampGrid’, class {
get properties() {
return {
behavior: {
columnResizeMode: “split”,
allowColumnAutoSizeOnDoubleClick: true
},
appearance: {
showRowHeaderNumber: true,
alternationCount: 2
},
paging: {
enabled: true,
pageSize: 10,
pageIndex: 0
},
pager: {
visible: true,
summary: {
visible: true,
position: “far”
},
pageSizeSelector: {
visible: true
}
},
editing: {
enabled: true,
mode: ‘row’,
action: ‘none’,
dialog: {
enabled: true
},
commandColumn: {
visible: true,
position: ‘far’,
dataSource: {
commandColumnEdit: {
visible: true
},
commandColumnDelete: {
visible: false
},
commandColumnMenu: {
visible: true
},
commandColumnRowMenu: {
visible: false
}
}
}
},
filtering: {
enabled: true
},
sorting: {
enabled: true,
mode: ‘many’
},
selection: {
enabled: true,
action: ‘click’,
mode: ‘one’
},
locale: ‘it’,
messages: {
‘it’: {
‘dialogEditHeader’: “Modifica {{value}}”,
‘columnMenuItemSortAsc’: ‘Ascendente {{mode}}’,
‘columnMenuItemSortDesc’: ‘Discendente {{mode}}’, //Sort A → Z
‘columnMenuItemRemoveSort’: ‘Rimuovi Ordinamento’
}
},
dataSource: new Smart.DataAdapter(
{
// dataSource: TimeStampLista,
dataSource: {
method: ‘POST’
, url: ‘../../include/TimeStamp_call.php’
, async: false
},
dataSourceType: ‘array’,
dataFields:
[
‘timeIDTs: number’,
‘timeIDAzienda: number’,
‘timeIDFunzione: number’,
‘timeIDServAs400: number’,
‘timeIDLibsAs400: number’,
‘timeTs: date’,
‘aziDescrizione: string’,
‘funzDescrizione: string’,
‘servNome: string’,
‘libNome: string’
]
}),
columns: [
{label: ‘ID’, dataField: ‘timeIDTs’, visible: false, width: 100, align: ‘center’},
{label: ‘ID Azienda’, dataField: ‘timeIDAzienda’, visible: false, width: 100, align: ‘center’},
{label: ‘ID Funzione’, dataField: ‘timeIDFunzione’, visible: false, width: 100, align: ‘center’},
{label: ‘ID Server’, dataField: ‘timeIDServAs400’, visible: false, width: 100, align: ‘center’},
{label: ‘ID Libreria’, dataField: ‘timeIDLibsAs400’, visible: false, width: 100, align: ‘center’},
{label: ‘Descrizione’, dataField: ‘funzDescrizione’, width: 300, align: ‘center’},
{label: ‘Azienda’, dataField: ‘aziDescrizione’, width: 150, align: ‘center’},
{label: ‘Data e Ora’, dataField: ‘timeTs’, width: 150, align: ‘center’, cellsFormat: ‘dd/MM/yyyy HH:mm:ss’},
{label: ‘Nome Server’, dataField: ‘servNome’, width: 150, align: ‘center’},
{label: ‘Nome Libreria’, dataField: ‘libNome’, width: 150, align: ‘center’}
]
};
}
});
but not function.
Can help me?April 29, 2020 at 2:11 pm #100728MartinMemberHello Fabio,
Could you clarify what do you mean that it doesn’t function?
Is there an issue with rendering the Grid or with binding the data source?
Thank you!
Best Regards,
Martin
Smart HTML Elements Team
https://www.htmlelements.comApril 29, 2020 at 2:40 pm #100729adminKeymasterHello Martin,
I think that the problem is binding the data source because the grid is empty.
Best regard.April 30, 2020 at 1:41 pm #100730MartinMemberHello Fabio,
Currently,Smart.DataAdapter
cannot get data from a file.
So, you can use fetch (or XMLHttpRequest, or jQuery.ajax()) to request the php file’s data and then pass it as an array to the Grid.
I hope that this answer would be helpful. Feel free to ask if you need further assistance.
Best Regards,
Martin
Smart HTML Elements Team
https://www.htmlelements.com -
AuthorPosts
- You must be logged in to reply to this topic.