Still on developpement the purpose it to have a DataTable that handle Ajax calls. I hope final version should be available soon.
Tips and tricks:
You can do a single order, just click on the header column, and if you want multi ordering press shift key with click.
Demo :
Configuration :
DataGreed.
Configuration are split into 5 sections : “options”, “labels”, “css” , “columns” and “buttons”.
- Options:
- "customParameters" => Custom parameters than you can send to the ressources page that generate the Json.
- "recordsPerPage" => Number of records visibles per page.
- "perPageOptions" => Values put in the selectbox per page.
- "dataSourceUrl" => Url to get data.
- "displayEmptyLines" => If return records are below records per page, it display blank row in the table.
- "horizontalScroll" => Horizontal scroll if needed
- "verticalScroll" => Vertical scroll if needed ( related to css )
- "responsive": true => If responsive on small devices
- "globaSearchMinLength" => Min chars for global search
- "globalSearch" => If global seach is visible or not
- "columnsSearch" => if value 'false' remove search by column event some columns has a search parameters defined.
- "header" => Definition for global header upper columns names
- "visualFilterForOrderedColumns" => Show different color for ordered columns
- "jumpPage" => Jump to page selectbox visible or not.
- "entriesInfo" => Entries infos visible or not.
- "outSideButtons" => if action buttons should be inside cell or outside
- "displayUnswitchColumnsAsExtraInfos" => If true columns with "visibility" eq "false" and "switchVisibility" eq "false" could be display into an extra block activated with a button.
- "highlight" : Hightlight or not found occurences.
- Labels ( i expect you know what it's related )
- Css
- "Table"
- "Pager position"
- Columns
- "name" => reference.
- "fctTransform" => To be able to do transformation on colums.
- "class" => Defined class.
- "visibility" => or not
- "orderVisibility" => if ordering is visible.
- "orderMode" => Ordering base value (none,"asc","desc")
- "search" => Defined or not if no search
- "type" => "input", "select".
- "dictionnary" => For select.
- "css" => Dedicate css.
- "value" =>
- "minLength" => min char for searching ( input only )
- "switchVisibility" => Indicate if column visibility could be switch or not.
- Buttons
- Struct "Action", "Label", "Css" , "Mode".
For button action take a look into the debug console.
Rem: For Css customisation the component is divided in 3 part. Classes for each part : “dataGreedToolBar”, “dataGreed” and “dataGreedPagination”. Feel free to create you own classes.
DataGreedFilter
Configuration are split into 2 sections : “labels”, “form”.
The example contains all type of input available for the search.
Dependecies :
Right now no dependencies except : Boostrap 4 (for the look and fell) ,Axios.
For the demo example we use also “momentjs” and “accouting.js” for the formating of data.
Warning :
If you use “displayUnswitchColumnsAsExtraInfos” feature avoid with boostrap 4 to use table-striped for “table” css in config.
For “customParameters” i prove an example but fell free to create you own structure for that variable. I’v create one to be able to present you the functionnality but feel free to create you own data structure and update the ressource Php file to suit to your need.
To do:
Versions :
2.4 - ( Justice League )
2.3 - ( Ultra Instinct )
2.2 - ( AOA - Oh Boy )
2.1 ( Womanizer - Britney Spears )
2.0 ( Battlestar Galactica 2003 )
1.9 ( Freestyler - Bomfunk MC’s )
1.8a
1.8 ( Kame Ha Me Ha )
1.7 ( Jack to the sound of the underground - Hit House )
1.6 ( Rebel Yell - Billy Idol )
1.5 ( Du Hast - Rammstein )
Component call:
<data-greed ref="main-data-greed" v-bind:config="dataGreedConfig" v-on:callback="getBtnCall"></data-greed>
getBtnCall should recieve two arguments. “Action” (edit), “Data”: the clicked row.
methods:
{
getBtnCall: function(a,d)
{
console.log("CALL FROM CHILD TO PARENT.");
console.log(arguments);
}
}
In model config. Two way for “Mode”:
buttons: [
{
"action": "edit_",
"label": "edit",
"css": "btn-primary",
"mode": "emit"
},
{
"action": "remove_",
"label": "remove",
"css": "btn-danger",
"mode": function(d)
{
console.log("INTERNAL FUNCTION CALL [DATA]");
console.log(d);
}
}]
1.4 ( DMT - Do Ma Thang - 3YE )
1.3c
1.3b
1.3a
1.3 ( Paradise city version)
1.2
1.1a
Update ReadMe.
1.1
Add search function. Rest ressource is done in php but with basic code fell free to rewrite it.
Author: shaan1974
Demo: https://codepen.io/shaan1974/pen/MWeKXye
Source Code: https://github.com/shaan1974/vuejs-data-greed
#vue #vuejs #javascript