My .haml file look like are as under:
here is we getting the data through getServerData() function
async function getServerData(data) {
const result = $.ajax({
url: '/show_folder_documents/'+#{@client.id},
method: 'GET',
data: data,
dataType: 'json'
});
return result;
}
defining coldef...
var columnDefs = [
{ field: 'group',hide:true},
{ field: 'folder_id',hide: true},
{ field: 'folder_name',hide: true}
];
defining gridoptions for aggrid...
// let the grid know which columns and what data to use
var gridOptions = {
autoGroupColumnDef: {
field: 'folder_name',
},
rowModelType: 'serverSide',
serverSideStoreType: 'partial',
treeData: true,
columnDefs: columnDefs,
rowSelection: 'multiple',
animateRows: true,
cacheBlockSize: 12,
isServerSideGroup: function (dataItem) {
// indicate if node is a group
return dataItem.group;
},
getServerSideGroupKey: function (dataItem) {
// specify which group key to use
return dataItem.folder_id;
},
};
using this createServerSideDatasource() function we can pass the data to ag grid
function createServerSideDatasource(data) {
function ServerSideDatasource(data) {
this.data = data;
}
ServerSideDatasource.prototype.getRows = async function (params) {
var mmm = await getServerData(params.request);
var doingInfinite = request.startRow != null && request.endRow != null;
var result = doingInfinite
? {
rowData: mmm['rows'],
rowCount: mmm.length,
}
: { rowData: mmm };
setTimeout(function () {
params.success(result);
}, 200);
};
return new ServerSideDatasource(data);
}
so how can we put the things about mapping and how to rendering the tree data we got roots folder but the thing is we stuck to get the subs of them
Aucun commentaire:
Enregistrer un commentaire