@tillhub/datatable v1.1.5
th-datatable
Handle data with uniform UX
- author - Tillhub
- license - UNLICENSED
slots
actionsactions-posttoolsexpanding-rowno-data
props
resourceString (required)Define which SDK resource is allowed and will be built.
custom-resourceObject (optional)default: undefinedresource-limitNumber (optional)default: undefinedThe limit of API items and hence size of an API page.
resource-queryObject (optional)default: undefinedThe options object that will be passed to the SDK
meta-optionsObject (optional)default: undefinedThe options object that will be passed to SDK when calling .meta functions
heightString (optional)default: '100%'Height in DOM
widthString (optional)default: '100%'Width in DOM
colorString (optional)default: 'black'Font color in DOM (not in use)
table-dataArray (optional)default: nullInjectable data. This will lead to API calls not being made (not in use)
headersArray (required)ElTable header configuration
show-toolsBoolean (optional)default: trueToggle visibility of the toolbar.
show-actionsBoolean (optional)default: trueToggle visibility of the action bar.
show-operationsBoolean (optional)default: trueToggle visibility of the operations bar.
headers-filterableBoolean (optional)default: undefinedToggle filterability of the headers
show-search-filterBoolean (optional)default: undefinedToggle visibilty of the search filter (ot in use).
search-filtersArray (optional)default: [object Object]Toggle visibilty of the search filters.
multiple-selectBoolean (optional)default: falseAllow multiple select and multi actions in the item list.
show-tool-headerBoolean (optional)default: trueToggle visibilty of the tool header.
operationsObject (optional)default: [object Object]Configure customisable operations.
pagingBoolean (optional)default: trueDefine whether to page or not (not in use)
no-meta-checkBoolean (optional)default: falseAllow or disallow meta checks. If disallowed, pages will rely on the local data count
show-loadingBoolean (optional)default: trueToggle loading indicator
do-routeBoolean (optional)default: falseDefine whether to route, e.g. on click events
do-route-filtersBoolean (optional)default: undefinedDefine whether to route on filters being set. This e.g. triggers query parameters in the browser
route-baseString (optional)default: [object Object]Define a base for routing, e.g. if you do not wish to route on the current URL.
page-sizeNumber (optional)default: 20Define a page size
page-sizesArray (optional)default: [object Object]Define available page sizes the user can choose from
transform-fetched-dataFunction (optional)default: undefinedTransform data the after it arrives from the SDK.
transform-table-dataFunction (optional)default: undefinedTransform data the before it will be injected into the DOM.
expanding-rowBoolean (optional)default: falseToggle expandable rows.
log-exceptionFunction (optional)default: [object Object]General error handler. Will be called with no-op if not set.
headers-configObject (optional)default: undefinedmessageString (optional)default: ''show-messageBoolean (optional)default: falseheaders-default-hideArray (optional)default: [object Object]buttonsArray (optional)default: [object Object]fuzzy-searchBoolean (optional)default: truesearch-filter-configObject (optional)default: [object Object]sortableBoolean (optional)default: falseToggle sortability
localeString (optional)default: 'en'Set locale to be used downstream (not in use)
row-menu-optionsArray (optional)default: [object Object]Configure ElTable row menus
handle-row-menu-clickFunction (optional)default: [object Object]Function that will be called on row menu click
data
localData
initial value: [object Object]
isLoading
initial value: false
currentPage
initial value: 1
page
initial value: [object Object]
totalCount
initial value: null
next
initial value: null
localPageSize
initial value: [object Object]
show
initial value: [object Object]
defaultFallback
initial value: '--'
computed properties
initialHeadersdependencies:
headersDefaultHide,headersConfigfilterHeadersdependencies:
headers,initialHeaders,initialHeadersloadingdependencies:
isLoading,showLoadingapiPageCountdependencies:
localDatatotalPagesdependencies:
totalCount,pageSize,totalCount,pageSizeparsedFilterdependencies:
$route,$route,$routehasFiltersdependencies:
parsedFilterisSearchdependencies:
hasFilters,parsedFilter,fuzzySearchdoMetaCheckdependencies:
noMetaCheck,hasFiltersshowNoDatadependencies:
localData,isLoading
events
loadingloadeddelete-requestededit-requestedsize-changedorder of execution might be important here, as we allow outside pageSize changes
will-handle-page-changecurrent-page-changedwill-handle-pagepage-handledhandled-countloading-errorrow-clickrow-dblclickselection-changeheaders-configsearch-filtersearch-filter-submitsearch-filter-submit-route
methods
fetch()Simultaneously fetch the total count and first page of a resource's data. Fetching requires a uniform layout of the Tillhub SDK, hence the availability of a resource as an instance class and that having a .meta and .getAll call that behavior exactly the same across pageable resources. That is also that a second API page will be returned as next cursor from the SDK.
This function propagetes some usage mistage as exceptions. It also handles some unexpected errors based on it's surroundings, e.g. throwing if no error listener is attached.
getResourceOptions()handleIncomingData(data)handleSearchData(data)handleNext(bound)handle an available next cursor. If a user jumps to any arbitrary page, we need to page until that data becomes available
parameters:
boundNumber - defines when to stop fetch recursively
deleteRow(index)let the caller handle deletion events
edit(index)the caller will be notified about edit requests, which usually will have routing to an edit page as a consequence. Since this is common we offer a convenience options to route based on the resource
extendedFormatter(item, formatter, field, index)apply a user defined formatter. If none is defined we expect the passed formatter to be the field value. TODO: review.
handleSizeChange(val)will be emitted from the pagination component. Any size change will cause the table to return to page 1
parameters:
valNumber - page size that was defined in the page size options
handleCurrentChange(val)any page control will trigger this event, e.g. a paging number or a goto input
parameters:
valAny - page index
handlePage()Slice local data based on current page and the page size. This function also handles boundaries and behaviors when one is overstepped.
handleMeta(metadata)Handle incoming metadata by setting total items etc.
parameters:
metadataObject - the result of a TH SDK .meta call
refresh()Refresh the data, triggering re-render if data is available
maybeHandleError(err)Emit an error to the caller if a listener is set. Otherwise throw.
parameters:
errError - upstream error
handleRowClick(row, column, event)Simple row click handler. Routes if doRoute is set.
handleRowDblClick(row, column, event)Simple row double click handler. Routes if doRoute is set or routing on double click is specifically requested.
Migh not be fired when click triggers first and has an action that will choke the second click.
parameters:
rowObject - EltableRowDatacolumnObject - EltableColumnDataeventObject - EltableColumnEvent
handleSelectionChange(val)Emit selection change to the implementor
parameters:
valObject - value of selected item
changeTotalCount(count)updateHeadersConfig(activeHeaders)injectFilter()handleSearchFilterInput(v)handleSearchFilterSubmit(v)toggleShow()getResourceInstance()isNull(value, fallback)sortChange(info)compareRow(a, b, info)isRowMenu(column, event)