TableComponent

This component allows you to create a custome server table. With server means it connects to a server API end-point. It depends on ValidationObserver from Vee Validate and it can receive any type of column-component created in the definition binded.

Example

TableComponent

<table-component
  :title="servicesDefinition.title"
  :records="records"
  :headers="servicesDefinition.vtable.headers"
>

export default {
  name: "App",
  data() {
    return {
      records: [],
      servicesDefinition: {
        vtable: {
          headers: [
            {
              text: "Service Id",
              value: "service_Id",
              align: "left",
              render: {
                type: NumberFormatColumnComponent,
              },
              sortable: true,
              class: "white-space-nowrap",
            },
            {
              text: "Service Name",
              value: "service_Name",
              align: "left",
              sortable: true,
              custom: true,
              render: {
                type: ContentButtonColumnComponent,
                props: {
                  content: "service_Name",
                  button: {
                    isRounded: true,
                    type: "",
                    icon: "monitor",
                    size: "is-small",
                    tooltip: {
                      label: "Visualize original values",
                      position: "is-top",
                      type: "is-white",
                    },
                  },
                },
                events: {
                  "button-clicked": this.showOriginalValues,
                },
              },
            },
            {
              text: "Service Provider",
              value: "service_Provider_Name",
              align: "left",
              sortable: true,
              custom: true,
              render: {
                type: ContentButtonColumnComponent,
                props: {
                  content: "service_Provider_Name",
                  button: {
                    isRounded: true,
                    type: "",
                    icon: "monitor",
                    size: "is-small",
                    tooltip: {
                      label: "Visualize original values",
                      position: "is-top",
                      type: "is-white",
                    },
                  },
                },
                events: {
                  "button-clicked": this.showOriginalValuesProvider,
                },
              },
            },
            {
              text: "Service Type",
              value: "service_Type_Name",
              align: "left",
              sortable: true,
              rendervalue: (v) => this.$snakeToTitle(v),
            },
            {
              text: "Event Actions",
              value: "",
              align: "left",
              render: {
                type: MultipleButtonsColumnComponent,
                props: {
                  buttons: [
                    {
                      icon: "monitor",
                      type: "is-primary",
                      tooltip: {
                        label: "Visualize events",
                        type: "is-primary",
                        position: "is-top",
                      },
                    },
                  ],
                },
                events: {
                  button0Clicked: this.visualizeServiceEvents,
                },
              },
              sortable: false,
            },
          ],
        },
        vbtn: {
          create: {
            show: false,
          },
        },
        title: "Services",
        sortTypeField: "sortType",
        findSearchField: "searchText",
        sortWithSign: true,
        sortFieldName: "sorts",
        paginationLengthField: "pageSize",
        headerIcon: "animation",
      },
    };
  },
};

Is mandatory that each column's header has it correspond value property. Is important to note that the value property is necesary not only to display a column text value, also it's received as a parameter on table sort event. If the value is not defined the sort method is not applied correctly.

The column's components available

Props

NameDescriptionTypeRequiredDefault
title-Stringfalse"Table Component"
titleClass-Stringfalse"is-size-5"
subtitle-Stringfalseundefined
subtitleClass-Stringfalse"is-size-6"
headerIcon-Stringfalse"table-star"
headers-Arrayfalse
stickyHeadersShow a sticky table headerBooleanfalsetrue
isInModal-Booleanfalsefalse
records-Arrayfalse
selected-Objectfalsenull
selectableSelectable columnBooleanfalsefalse
focusable-Booleanfalsefalse
checkableColumn checkeableBooleanfalsefalse
headerCheckable-Booleanfalsefalse
isRowChekable-Functionfalse() => true
draggable-Booleanfalsefalse
draggableColumn-Booleanfalsetrue
dragEffect-Stringfalse"move"
isLoading-Booleanfalsefalse
isDetailed-Booleanfalsefalse
showDetailIcon-Booleanfalsetrue
showSearchFilter-Booleanfalsefalse
showTableConfigurations-Booleanfalsefalse
rowClass-Functionfalseundefined
localeLocale string {en, es ...} for display language on componentStringfalse"es"
customHeaders-Booleanfalsefalse
opened-Arrayfalse
checkedRowsIdsList of external Ids of checked rows to checkArrayfalse
getCheckedRowsReturn [] of row objects that fit a criteria to sync to internal checked rows. Recives (ids, records)Functionfalseundefined
nameName of the component that uses itStringfalse""

Events

Event NameDescriptionParameters
update:selected--
checkedRows--
clearSearch--
columnDragStart--
columndrop--
contextmenu--
dragStart--
onDrop--
filter--
open-column-filter--
cleanFilters--

Slots

NameDescriptionDefault Slot Content
header-extra-content--
header-buttons--
right-header-content--
footer--
extra-contentExtra content-