You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brisk works on making the process of producing datatables easier and faster by keeping the hard usually repeated stuff on Brisk and focusing on building your special tables without giving a lot of care about the small trivial issues if they were clearly constrained or not.
Requested Backend JSON Format:
Used to control frontend
Coming versions will work on enabling the control of all frontend attributes from backend side.
Table resource GET JSON Format:
{
"filters_title":"Filters Panel Title",
"filters":[
{
"title":"Select Filter Title", //filter title
"type":"select", //filter type
"name":"type_serial_no", //filter name
"classes":[ //any custom classes
],
"data":{
"options_source":"treatment_types", //filter resource name
"has_empty":false, //show/hide [empty option] in the list
"has_all":true, //show/hide [all options] option in the list
"has_none":false //show/hide [none of options] option in the list
}
},
{
"title":"Input Filter Title",
"type":"input",
"name":"full_name",
"placeholder":"Type here full name plz..",
"classes":[
]
},
{
"title":"From Date:",
"type":"input",
"name":"from_date",
"placeholder":"",
"classes":[
],
"date":true //so frontend will MASK this input to date format
},
{
"title":"To Date:",
"type":"input",
"name":"to_date",
"placeholder":"",
"classes":[
],
"date":true
}
],
"table_title":"Table Panel Title",
"columns":[
{
"title":"Type", //column title
"sortable":true, //to enable/disable sotring by this column
"column":"type_title" //column title in DB
},
{
"title":"Full Name",
"sortable":true,
"column":"full_name"
},
{
"title":"Zone",
"sortable":true,
"column":"zone_title"
},
{
"title":"Record Date",
"sortable":true,
"column":"record_date",
"numeric":true //to make sure of displaying it in a good numeric format
},
{
"title":"Sector Title",
"sortable":true,
"column":"redirect_to_sector_title"
}
],
"footer":{
"info":"Some text about client balance for example.", //allows you to push any notification about this table to its view
"execution_time":"0.0090" //allows you to pass server side processing time in seconds to frontend
},
"current_page":1,
"data":[], //your table data comes here
"from":1,
"last_page":25,
"per_page":30,
"to":30,
"total":726
}
Frontend Part:
1. You need to declare very simple <div> and give it any ID you want, in our demo:
var initOptions = {
language: 'en',
filters: {
title: "Filtering Tools",
enable: true,
active: true
},
datatable: {
title: "Brisk DataTable Demo",
resource: {
base_url: 'http://domain-name.com',
entity: '/resource',
datatable: '/datatable-get-method' //required returned JSON format was described in the beginning of README
},
buttons: [
{
title: "New record",
data_action: "insert",
classes: {
button: "btn btn-xs btn-primary",
icon: "fa fa-plus"
}
}
],
order_by: {
column: 'serial_no',
method: 'DESC'
}
}
};
3. Brisk Instance declaration:
var briskDemo = new $.BriskDataTable($("#brisk-demo"), initOptions);
briskDemo.InitBrisk(); //initilaize the table and its filters HTML
briskDemo.get(); //gets table data, and filters
4. Reach Brisk table buttons:
You can access any event of the injected buttons to the table using this format, by [data_action] which you already declared in the options: