Not the method works .remove() in JavaScript?

I use additional Webix widgets for JS. Adding Delete button to a method remove(), nothing happens.

{% extends "base.html" %}

{% block content %}

<script type="text/javascript" charset="utf-8"> 
var grid_data = [
 { id:1, title:"The Shawshank Redemption", year:1994, votes:678790, 
rating:9.2, rank:1},
 { id:2, title:"The Godfather", year:1972, votes:511495, rating:9.2, 
rank:2},
 { id:3, title:"The Godfather: Part II", year:1974, votes:319352, 
rating:9.0, rank:3},
 { id:4, title:"The Good, The Bad and the Ugly", year:1966, votes:213030, 
rating:8.9, rank:4},
 { id:5, title:"My Fair Lady", year:1964, votes:533848, rating:8.9, 
rank:5},
 { id:6, title:"12 Angry Men", year:1957, votes:164558, rating:8.9, rank:6}
]; 



function addItem(){
 $$("table").add({ title:"New item" });
};

delItme function(){
 var list = $$("table");
 var item_id = list.getSelectedId();
 if (item_id){
list.remove(item_id);
}
}




webix.ui({
rows:[
 { view:"toolbar", elements:[
 { view:"button", value:"Add item" click:addItem },
 {view:"button", value:"Delete", click:delItme
}

]},
{
 view:"datatable", 
id:"table",
editable:true,
columns:[
 { id:"title", fillspace:true, header:"Title", editor:"text" }, 
],


} 
 ] 
});

$$("table").parse(grid_data);


</script>

{% endblock %}

{% block footer %}
{% endblock %}
April 3rd 20 at 18:50
3 answers
April 3rd 20 at 18:52
Solution
Seems to function getSelectedId working correctly, use the configure the select
webix.ui({
view:"datatable",
select:"row",
...
})


P. S. please use the sandbox to share the code here
Can you show the example of my code? - Bridget commented on April 3rd 20 at 18:55
@Bridget, https://snippet.webix.com/gefxw6mq - Clare.Beier commented on April 3rd 20 at 18:58
@Clare.Beier, thank you very much)
Just have a question regarding the ID of the new elements. Why the number 1577097736081 (and similar size) are the ID of the new element? - Bridget commented on April 3rd 20 at 19:01
@Bridget, Apparently, if you don't ask yourself, does the value Date.now() or something like that
All that on incrementorum - Clare.Beier commented on April 3rd 20 at 19:04
April 3rd 20 at 18:54
Which browser look? The remove method is new, it needed to have polyfil. Babel use?
April 3rd 20 at 18:56
delItme function(){
 var list = $$("table");
 var item_id = list.getSelectedId();
item_id.remove();
}
I hope you only item_id wanted - Angeline32 commented on April 3rd 20 at 18:59
@Angeline32, no, unfortunately. I don't understand why it doesn't deletes the selected column - Bridget commented on April 3rd 20 at 19:02
@Bridget, you only item_id need to remove? Or another list? - Angeline32 commented on April 3rd 20 at 19:05
@Angeline32only item_id, but for some reason he is not deleted( - Bridget commented on April 3rd 20 at 19:08
@Bridget, in what conditions to delete the column? - Angeline32 commented on April 3rd 20 at 19:11
@Angeline32, it should be removed when it is isolated with the left mouse button - Bridget commented on April 3rd 20 at 19:14
@Bridget, I can't help you in my examples work, I can not create the conditions for the allocation - Angeline32 commented on April 3rd 20 at 19:17
@Angeline32fails item_id.remove is not a function - Bridget commented on April 3rd 20 at 19:20
@Bridget, apparently .remove() took code with HTML - Bridget commented on April 3rd 20 at 19:23
delItme function(){
 var list = $$("table");
 var item_id = list.getSelectedId();
 if (item_id){
 }else {
item_id.remove();
}
}
- Angeline32 commented on April 3rd 20 at 19:26

Find more questions by tags JavaScriptHTML