How to get selected rows' index in Table element in iview vue?
up vote
0
down vote
favorite
How to get selected rows' index in Table element in iview vue?
For example, table element is like below:
<Table ref="selection" :columns="columns4" :data="data1" @on-selection-change="updateSelectedNumber"></Table>
vue.js html-table iview
add a comment |
up vote
0
down vote
favorite
How to get selected rows' index in Table element in iview vue?
For example, table element is like below:
<Table ref="selection" :columns="columns4" :data="data1" @on-selection-change="updateSelectedNumber"></Table>
vue.js html-table iview
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 at 2:01
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How to get selected rows' index in Table element in iview vue?
For example, table element is like below:
<Table ref="selection" :columns="columns4" :data="data1" @on-selection-change="updateSelectedNumber"></Table>
vue.js html-table iview
How to get selected rows' index in Table element in iview vue?
For example, table element is like below:
<Table ref="selection" :columns="columns4" :data="data1" @on-selection-change="updateSelectedNumber"></Table>
vue.js html-table iview
vue.js html-table iview
edited Nov 15 at 11:03
Brian Tompsett - 汤莱恩
4,1631336100
4,1631336100
asked Nov 15 at 1:57
chucklai
1911311
1911311
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 at 2:01
add a comment |
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 at 2:01
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 at 1:59
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 at 2:01
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 at 2:01
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
GET data rows item clicked.
To get the index of the item clicked, simply click on the line you want, not above the checkbox, over the item that is not the box, but that is on the same line.
add this tag
methods: {
valueRowClick(value)
console.log(value)
}
result:
position: 0 -> Object
position 1: -> Index item clicked 2
When you select an item, according to the documentation it throws the value of the selected items out.
GET data item select
<table @on-select="nameFunction">
methods: {
nameFunction (value) {
console.log(value)
}
}
DELETE ITEM EXAMPLE:
add the this tag TABLE
<table @on-selection-change="valueItemsSelected"></table>
methods: {
valueItemsSelected(value){
if(value.length > 0){
for(let y = 0, max1 = value.length; y < max1; y ++){
for(let i = 0, max = this.data1.length; i < max; i++){
if(value[y] === this.data1[i]) {
this.data1.splice(i, 1)
}
}
}
}
}
},
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
|
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
GET data rows item clicked.
To get the index of the item clicked, simply click on the line you want, not above the checkbox, over the item that is not the box, but that is on the same line.
add this tag
methods: {
valueRowClick(value)
console.log(value)
}
result:
position: 0 -> Object
position 1: -> Index item clicked 2
When you select an item, according to the documentation it throws the value of the selected items out.
GET data item select
<table @on-select="nameFunction">
methods: {
nameFunction (value) {
console.log(value)
}
}
DELETE ITEM EXAMPLE:
add the this tag TABLE
<table @on-selection-change="valueItemsSelected"></table>
methods: {
valueItemsSelected(value){
if(value.length > 0){
for(let y = 0, max1 = value.length; y < max1; y ++){
for(let i = 0, max = this.data1.length; i < max; i++){
if(value[y] === this.data1[i]) {
this.data1.splice(i, 1)
}
}
}
}
}
},
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
|
show 1 more comment
up vote
0
down vote
accepted
GET data rows item clicked.
To get the index of the item clicked, simply click on the line you want, not above the checkbox, over the item that is not the box, but that is on the same line.
add this tag
methods: {
valueRowClick(value)
console.log(value)
}
result:
position: 0 -> Object
position 1: -> Index item clicked 2
When you select an item, according to the documentation it throws the value of the selected items out.
GET data item select
<table @on-select="nameFunction">
methods: {
nameFunction (value) {
console.log(value)
}
}
DELETE ITEM EXAMPLE:
add the this tag TABLE
<table @on-selection-change="valueItemsSelected"></table>
methods: {
valueItemsSelected(value){
if(value.length > 0){
for(let y = 0, max1 = value.length; y < max1; y ++){
for(let i = 0, max = this.data1.length; i < max; i++){
if(value[y] === this.data1[i]) {
this.data1.splice(i, 1)
}
}
}
}
}
},
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
|
show 1 more comment
up vote
0
down vote
accepted
up vote
0
down vote
accepted
GET data rows item clicked.
To get the index of the item clicked, simply click on the line you want, not above the checkbox, over the item that is not the box, but that is on the same line.
add this tag
methods: {
valueRowClick(value)
console.log(value)
}
result:
position: 0 -> Object
position 1: -> Index item clicked 2
When you select an item, according to the documentation it throws the value of the selected items out.
GET data item select
<table @on-select="nameFunction">
methods: {
nameFunction (value) {
console.log(value)
}
}
DELETE ITEM EXAMPLE:
add the this tag TABLE
<table @on-selection-change="valueItemsSelected"></table>
methods: {
valueItemsSelected(value){
if(value.length > 0){
for(let y = 0, max1 = value.length; y < max1; y ++){
for(let i = 0, max = this.data1.length; i < max; i++){
if(value[y] === this.data1[i]) {
this.data1.splice(i, 1)
}
}
}
}
}
},
GET data rows item clicked.
To get the index of the item clicked, simply click on the line you want, not above the checkbox, over the item that is not the box, but that is on the same line.
add this tag
methods: {
valueRowClick(value)
console.log(value)
}
result:
position: 0 -> Object
position 1: -> Index item clicked 2
When you select an item, according to the documentation it throws the value of the selected items out.
GET data item select
<table @on-select="nameFunction">
methods: {
nameFunction (value) {
console.log(value)
}
}
DELETE ITEM EXAMPLE:
add the this tag TABLE
<table @on-selection-change="valueItemsSelected"></table>
methods: {
valueItemsSelected(value){
if(value.length > 0){
for(let y = 0, max1 = value.length; y < max1; y ++){
for(let i = 0, max = this.data1.length; i < max; i++){
if(value[y] === this.data1[i]) {
this.data1.splice(i, 1)
}
}
}
}
}
},
edited Nov 15 at 3:03
answered Nov 15 at 2:09
Hamilton Gabriel
965
965
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
|
show 1 more comment
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
Actually I want to do batch deletion. After selecting rows, I want to delete them one by one. It is complicated to maintain an additional array of selected tags. Is there any other more convenient way to accomplish it ?
– chucklai
Nov 15 at 2:18
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
No it's not, I'll edit my answer with an example of the requested one. I showed the example of how to get the index.
– Hamilton Gabriel
Nov 15 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
i Add @chucklai
– Hamilton Gabriel
Nov 15 at 2:32
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
there maybe a little misunderstanding. I want to delete selected rows whose checkbox is checked without knowing the actually ID or other attributes.
– chucklai
Nov 15 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
a moment for kindness
– Hamilton Gabriel
Nov 15 at 2:46
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311349%2fhow-to-get-selected-rows-index-in-table-element-in-iview-vue%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 at 2:01