How to get selected rows' index in Table element in iview vue?
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 |
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 '18 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 '18 at 2:01
add a comment |
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 '18 at 11:03
Brian Tompsett - 汤莱恩
4,2421339102
4,2421339102
asked Nov 15 '18 at 1:57
chucklaichucklai
3021413
3021413
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 '18 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 '18 at 2:01
add a comment |
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 '18 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 '18 at 2:01
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 '18 at 1:59
is it using some framework to issue the table?
– Hamilton Gabriel
Nov 15 '18 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 '18 at 2:01
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 '18 at 2:01
add a comment |
1 Answer
1
active
oldest
votes
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 '18 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 '18 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 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 '18 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 at 2:46
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 '18 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 '18 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 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 '18 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 at 2:46
|
show 1 more comment
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 '18 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 '18 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 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 '18 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 at 2:46
|
show 1 more comment
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 '18 at 3:03
answered Nov 15 '18 at 2:09
Hamilton GabrielHamilton Gabriel
1065
1065
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 '18 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 '18 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 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 '18 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 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 '18 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 '18 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 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 '18 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 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 '18 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 '18 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 '18 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 '18 at 2:22
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 at 2:32
i Add @chucklai
– Hamilton Gabriel
Nov 15 '18 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 '18 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 '18 at 2:41
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 at 2:46
a moment for kindness
– Hamilton Gabriel
Nov 15 '18 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.
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 '18 at 1:59
@HamiltonGabriel yes, I'm using Vue and iView.
– chucklai
Nov 15 '18 at 2:01