Javascript item in list of select element









up vote
-1
down vote

favorite












enter image description here



I have list item with checkbox. when the item is selected, put it in the list.
now, I need to indicate by input which one will be first in the list and etc...



if i remove the item by checkbox i also need to manage others items selected



I don't have any idea to implement that



this is my code for checkbox.



selectedEvent(rowData) 
const index = this.isAlreadyDone ? rowData.EventId : rowData.file.EventId;
const item = this.EventsSelected.indexOf(index.toString());
if (item > -1 && !rowData.EventId)
this.EventsSelected = this.EventsSelected.filter(item => item !== index.toString());
else
if (rowData.EventId)
this.EventsSelected.push(index.toString());












share|improve this question



















  • 3




    could you clarify the question with example and code
    – hana_wujira
    19 hours ago










  • You have the example in image
    – Hassan BAHA
    19 hours ago










  • Please, always add a Minimal, Complete, and Verifiable example to your question.
    – evolutionxbox
    19 hours ago










  • I added my code for selected item by checkbox but i dont know if it is helpful *$
    – Hassan BAHA
    19 hours ago










  • What do you mean by if i remove the item by checkbox i also need to manage others items selected? Also, what if the user types in a sort order randomly? like 58 and 2 for eg for the items that you're showing? Will your list allow that? Or will it have just the items and it won't allow.
    – SiddAjmera
    18 hours ago














up vote
-1
down vote

favorite












enter image description here



I have list item with checkbox. when the item is selected, put it in the list.
now, I need to indicate by input which one will be first in the list and etc...



if i remove the item by checkbox i also need to manage others items selected



I don't have any idea to implement that



this is my code for checkbox.



selectedEvent(rowData) 
const index = this.isAlreadyDone ? rowData.EventId : rowData.file.EventId;
const item = this.EventsSelected.indexOf(index.toString());
if (item > -1 && !rowData.EventId)
this.EventsSelected = this.EventsSelected.filter(item => item !== index.toString());
else
if (rowData.EventId)
this.EventsSelected.push(index.toString());












share|improve this question



















  • 3




    could you clarify the question with example and code
    – hana_wujira
    19 hours ago










  • You have the example in image
    – Hassan BAHA
    19 hours ago










  • Please, always add a Minimal, Complete, and Verifiable example to your question.
    – evolutionxbox
    19 hours ago










  • I added my code for selected item by checkbox but i dont know if it is helpful *$
    – Hassan BAHA
    19 hours ago










  • What do you mean by if i remove the item by checkbox i also need to manage others items selected? Also, what if the user types in a sort order randomly? like 58 and 2 for eg for the items that you're showing? Will your list allow that? Or will it have just the items and it won't allow.
    – SiddAjmera
    18 hours ago












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











enter image description here



I have list item with checkbox. when the item is selected, put it in the list.
now, I need to indicate by input which one will be first in the list and etc...



if i remove the item by checkbox i also need to manage others items selected



I don't have any idea to implement that



this is my code for checkbox.



selectedEvent(rowData) 
const index = this.isAlreadyDone ? rowData.EventId : rowData.file.EventId;
const item = this.EventsSelected.indexOf(index.toString());
if (item > -1 && !rowData.EventId)
this.EventsSelected = this.EventsSelected.filter(item => item !== index.toString());
else
if (rowData.EventId)
this.EventsSelected.push(index.toString());












share|improve this question















enter image description here



I have list item with checkbox. when the item is selected, put it in the list.
now, I need to indicate by input which one will be first in the list and etc...



if i remove the item by checkbox i also need to manage others items selected



I don't have any idea to implement that



this is my code for checkbox.



selectedEvent(rowData) 
const index = this.isAlreadyDone ? rowData.EventId : rowData.file.EventId;
const item = this.EventsSelected.indexOf(index.toString());
if (item > -1 && !rowData.EventId)
this.EventsSelected = this.EventsSelected.filter(item => item !== index.toString());
else
if (rowData.EventId)
this.EventsSelected.push(index.toString());









javascript arrays angular sorting






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 19 hours ago

























asked 19 hours ago









Hassan BAHA

588




588







  • 3




    could you clarify the question with example and code
    – hana_wujira
    19 hours ago










  • You have the example in image
    – Hassan BAHA
    19 hours ago










  • Please, always add a Minimal, Complete, and Verifiable example to your question.
    – evolutionxbox
    19 hours ago










  • I added my code for selected item by checkbox but i dont know if it is helpful *$
    – Hassan BAHA
    19 hours ago










  • What do you mean by if i remove the item by checkbox i also need to manage others items selected? Also, what if the user types in a sort order randomly? like 58 and 2 for eg for the items that you're showing? Will your list allow that? Or will it have just the items and it won't allow.
    – SiddAjmera
    18 hours ago












  • 3




    could you clarify the question with example and code
    – hana_wujira
    19 hours ago










  • You have the example in image
    – Hassan BAHA
    19 hours ago










  • Please, always add a Minimal, Complete, and Verifiable example to your question.
    – evolutionxbox
    19 hours ago










  • I added my code for selected item by checkbox but i dont know if it is helpful *$
    – Hassan BAHA
    19 hours ago










  • What do you mean by if i remove the item by checkbox i also need to manage others items selected? Also, what if the user types in a sort order randomly? like 58 and 2 for eg for the items that you're showing? Will your list allow that? Or will it have just the items and it won't allow.
    – SiddAjmera
    18 hours ago







3




3




could you clarify the question with example and code
– hana_wujira
19 hours ago




could you clarify the question with example and code
– hana_wujira
19 hours ago












You have the example in image
– Hassan BAHA
19 hours ago




You have the example in image
– Hassan BAHA
19 hours ago












Please, always add a Minimal, Complete, and Verifiable example to your question.
– evolutionxbox
19 hours ago




Please, always add a Minimal, Complete, and Verifiable example to your question.
– evolutionxbox
19 hours ago












I added my code for selected item by checkbox but i dont know if it is helpful *$
– Hassan BAHA
19 hours ago




I added my code for selected item by checkbox but i dont know if it is helpful *$
– Hassan BAHA
19 hours ago












What do you mean by if i remove the item by checkbox i also need to manage others items selected? Also, what if the user types in a sort order randomly? like 58 and 2 for eg for the items that you're showing? Will your list allow that? Or will it have just the items and it won't allow.
– SiddAjmera
18 hours ago




What do you mean by if i remove the item by checkbox i also need to manage others items selected? Also, what if the user types in a sort order randomly? like 58 and 2 for eg for the items that you're showing? Will your list allow that? Or will it have just the items and it won't allow.
– SiddAjmera
18 hours ago

















active

oldest

votes











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',
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
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224123%2fjavascript-item-in-list-of-select-element%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224123%2fjavascript-item-in-list-of-select-element%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo