1

I am using the CoreUI admin theme for VueJs.

I am trying to make a table via CoreUI. Now I have to make the rows of the table Clickable.

Any idea as to how I can do that?

Here is there documentation on Tables: https://coreui.io/vue/docs/components/table.html#cdatatable-api In there CDataTable API under events , they have row-clicked events. I just don't know how to use it.

Any sorts of help will be appreciated.

1 Answer 1

3

add event listner like this please focus on @row-clicked="rowClickHandler" and method rowClickHandler in methods

    <template>
      <CCardBody>
        <CDataTable
          :items="items"
          :fields="fields"
          @row-clicked="rowClickHandler"  // <== focus here
        >
          ... Rest of the code
        </CDataTable>
      </CCardBody>
    </template>
    <script>

export default {
  name: 'AdvancedTables',
  data () {
    return {
      items: [],
      fields: [],
    }
  },
  methods: {
    rowClickHandler ((item, index, column name, event) {
    // whatever you want to do
    },
   ... other methods
  }
}
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.