BDT - getter-setter

Basic Data Table

v 2.1.2

Getter, Setter, Function  

...OPEN CONSOLE, combine properties a change action in table

Name Getter Setter Comment Example JS
bdt = new basic-data-table(...)
Example template
id Get id of basic-data-table. Id use for localStorage for tmp values. {{ id }}
limit Get/Set limit items on page. bdt.limit bdt.limit = 8 {{ limit }} @click="setLimit(8)"
page Get/Set page number. = 2 {{ page }} @click="setPage(2)"
pages Get pages number. bdt.pages {{ pages }}
counts Get basic counts. bdt.counts {{ counts.items }} {{ counts.pageItems }} {{ counts.filteredItems }} {{ counts.checkedItems }}
items Get/Set all items. bdt.items bdt.items = [{'fld_ID': 5000,'fld_Name': 'Martin'}, ...] do not use
item Set one item (add/edit).
It is just an entry in the table.
You don't solve the work with the database!
bdt.item = {i:index, k:'primKey', v:ary}; // or bdt.item = {k:'fld_ID', v:{'fld_ID': 1003,'fld_Name': 'Kasey has change...'}}
row(k,v) Return item by key and value. Only one, first of find in all items. bdt.row('fld_ID', 1003)
filteredItems Get filtered items. bdt.filteredItems
checkedItems Get items who is checked. bdt.checkedItems
pageItems Get items on page. bdt.pageItems v-for="item in pageItems"
draggable Moving enable/disable. Must have config in template. bdt.draggable bdt.draggable = true {{ draggable }} @click="draggable=!draggable"
isWorking Return true/false. It is test value. True if just now workinng ...runnig filter, read data, moving, etc. bdt.isWorking :disabled="isWorking"
tmp Get/Set tmp variable. bdt.tmp bdt.tmp = {abc:123} {{ }} v-model=""
isFilter Get boolean filter status. bdt.isFilter v-if="isFilter"
filter Get/Set actual filter rule.
Setter is alias for setFilter.
bdt.filter bdt.filter = { myKey: [ {k: 'fld_ID', v: '1008'} ] } {{ filter }} @click="setFilter(...)"
setFilter Set new filter rule. bdt.setFilter = { idFrom: [ { k: 'fld_ID', v: '>= 1008', t: 'number' } ] } @click="setFilter(...)"
addFilter Add to filter rule. bdt.addFilter = { idTo: [ { k: 'fld_ID', v: '<= 1010', t: 'number' } ] } @click="addFilter(...)"
resetFilter() Remove all filters. bdt.resetFilter() @click="resetFilter()"
resetFilter(...keys) Remove filters by keys. bdt.resetFilter( 'idFrom', 'idTo' ) @click="resetFilter(...)"
unchecked() Unchecked all items. bdt.unchecked() @click="unchecked()"
onItems User function after change all items (reload). bdt.onItems = ()=>{...} do not use
onItem User function after any change in items. bdt.onItem = ()=>{...}
onMove User function after moving row. bdt.onMove = ()=>{...}
onChecked User function after any change in checkbox. bdt.onChecked = ()=>{...}
onFilter User function after change filter. bdt.onFilter = ()=>{...}
onPage User function after change page number. bdt.onPage = ()=>{...}
onSort User function after sorting. bdt.onSort = ()=>{...}
Math operation sum(), avg(), count() /*
'filteredItems' - type of Items ('filteredItems', 'pageItems', 'checkedItems')
'fld_ID' - key for Math operation
'tmp_SumFiltered_ID' - the name of the variable where the result is stored (optional) - look tmp getter
sum() Sum of columns data. bdt.sum( 'filteredItems', 'fld_ID', 'tmp_SumFiltered_ID' ) {{ tmp_SumFiltered_ID }}
avg() Average of columns data. bdt.avg( 'filteredItems', 'fld_ID', 'tmp_AvgFiltered_ID' ) {{ tmp_AvgFiltered_ID }}
count() Count of columns data. bdt.count( 'filteredItems', 'fld_ID', 'tmp_CountFiltered_ID' ) {{ tmp_CountFiltered_ID }}
* unique
Count of columns unique data. bdt.count( 'filteredItems', 'fld_ID', true, 'tmp_CountUniqueFiltered_ID' ) {{ tmp_CountUniqueFiltered_ID }}