1.2.2 ā€¢ Published 3 years ago

vue-dream-table v1.2.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Vue js dream table is developed to make your life easier. Only endpoint url and by configuring few options you can get high performanced table with ton of functionality such as server side pagination, sorting, searching, and filtering.

šŸ  Homepage

Install

npm install vue-dream-table

Note

  vue-dream-table package depends on vue-router... Please be sure that you have already installed it!

Usage

<template>
    <vue-dream-table :options="options"  />
</template>

<script>
import VueDreamTable from "vue-dream-table";

export default {
    components: {
      VueDreamTable,
    },

    data() {
    return {
      options: {
        getUrl: "https://jsonplaceholder.typicode.com/users",
        dataName: ["data", "rows"],
        token:
          "eyJhbGciOviJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwveaviaWF0IjoxNjMyNjczODExLCJleHAiOjE2MzI2Nzc0MTF9ev.R8hZz-0qCXRnR04veev0-yeFr1MlpWT-iaxUxIsN9WCtW_LwdpdoUTQaX155tcvezKPdW8iLWvfYeGmHZqzfrp_nScArAev",
        title: "This is a title",
        isLoad: true,
        hiddenItemsByDefault: ["id"],
        capitalize: true,
        removeUnderScores: true,
        maxStrSize: 15,
        allowAddNewItem: true
      },
    };
  },
}
</script>

Props

DataTypeRequiredDescriptionDefault Values
getUrlstringfalseGet data url"https://jsonplaceholder.typicode.com/users"
tokenstringfalseIf your back-end needs token pass this prop""
isLoadbooleanfalseShow loader when request status is pendingfalse
loaderImgstringfalseShow loading as img
dataNamearrayfalsePath to get data // "rows" -> response.data.rows[]
hiddenItemsByDefaultarrayfalseHide table fields[]
actionsbooleanfalseShow or hide table actionsfalse
editablebooleanfalseShow or hide edit button. Visible if "actions" -> truefalse
deletablebooleanfalseShow or delete button. Visible if "actions" -> truefalse
actionAsIconbooleanfalseShow action buttons as iconfalse
capitalizebooleanfalseCapitalize table column namesfalse
removeUnderScoresbooleanfalseRemove underscores from column namesfalse
maxStrSizenumberfalseSplit text25
allowAddNewItembooleanfalseShow Add button to. Return callback -> addNewItemHandler(data)false

Advanced

  <template>
    <vue-dream-table :options="options"  />
  </template>

  <script>
  import VueDreamTable from "vue-dream-table";

  export default {
    data() {
      return {
        options: {
           getUrl: "https://jsonplaceholder.typicode.com/users",
        dataName: ["data", "rows"],
        token:
          "eyJhbGciOviJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwveaviaWF0IjoxNjMyNjczODExLCJleHAiOjE2MzI2Nzc0MTF9ev.R8hZz-0qCXRnR04veev0-yeFr1MlpWT-iaxUxIsN9WCtW_LwdpdoUTQaX155tcvezKPdW8iLWvfYeGmHZqzfrp_nScArAev",
        title: "This is a title",
        isLoad: true,
        hiddenItemsByDefault: ["id"],
        capitalize: true,
        removeUnderScores: true,
        maxStrSize: 15,
        allowAddNewItem: true,
        actions: true,
        editable: true,
        deletable: true,
        deleteRequest: {
          url: "https://jsonplaceholder.typicode.com/posts",
          method: "delete",
          deleteRequestParam: "id",
        },

        filters: {
          search: {
            placeholder: "Search",
            searchBy: "name",
            // key: "search", --> search: {[searchBy]: value}
          },

          select: { 
            selectBy: "key",
            optionValue: ["one", "two", "three"],
            // key: "filter", --> filter: {[selectBy]: value} 
          },

          sort: {
            sortBy: "id",
            sortOrder: "desc",
          },

          pagination: {
            count: 100,
            limit: ['limit', 10], // [0] -> key, [1] -> value  
            // pageKey: 'current_page', // default key -> page
          },
        }
      }
    }
  }
  </script>

Author

šŸ‘¤ mnjoyan

CallBacks

<template>
    <vue-dream-table :options="options"
       @mountedHandler="mountedHandler"
       @beforeDataRecive="beforeDataRecive"   
       @dataReceivedHandler="dataReceivedHandler"
       @getDataFailureHandler="getDataFailureHandler"
       @createdHandler="createdHandler"
       @deleteHandler="deleteHandler"
       @deleteFailureHandler="deleteFailureHandler"
       @addNewItemHandler="addNewItemHandler"
       @showMoreHandler="showMoreHandler"
         />
</template>


<script>
  export default {
    methods: {
        dataReceivedHandler(data) {
          // data
        },

        getDataFailureHandler(err) {
          // err
        },

        createdHandler(data) {
          // data
        },

        mountedHandler() {
          // mounted
        },

        deleteHandler(data) {
          // data
        },

        deleteFailureHandler(err) {
          // err
        },

        addNewItemHandler(data) {
          // data
        },

        showMoreHandler(obj) {
          // obj
        }
    }
  }
</script>

Show your support

Give a ā­ļø if this project helped you!

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.1.2

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.15

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.14

3 years ago

0.1.3

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.9

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago