Delete rows from table
See original GitHub issueHi,
I am trying to delete rows (users) from the table based on an ID. When I check more than one box I get the ID of each select which I then add to a hidden input with the the value being the ids - example value="1,2"
I then wrote function to delete the users from the database, but it is only deleting the first section in this example only userid 1 would be deleted from DB.
Here is an example of the delete user code.
function removeRow(){
var url = 'remove-user.php';
var id = document.getElementById("user-id").value;
var data = 'userID=' + id;
$.ajax({
url: url,
data: data,
cache: false,
error: function(e){
alert(e);
},
success: function () {
var selects = $('#users-table').bootstrapTable('getSelections');
ids = $.map(selects, function (row) {
return row.id;
});
$('#users-table').bootstrapTable('remove', {
field: 'id',
values: ids
});
}
});
}
Do you have any other suggestion on how I could do this?
Again, it is not deleting all selections only the first one.
Issue Analytics
- State:
- Created 9 years ago
- Comments:20 (5 by maintainers)
Top Results From Across the Web
SQL DELETE Statement
The DELETE statement is used to delete existing records in a table. ... It is possible to delete all rows in a table...
Read more >SQL - DELETE Query
The SQL DELETE Query is used to delete the existing records from a table. You can use the WHERE clause with a DELETE...
Read more >How to Delete a Row in SQL – Example Query
In SQL, you can delete a row in a table by using the DELETE query and the WHERE clause. In the article, I...
Read more >Delete rows and columns from a table
A fast way to delete a row or column from a table in Word Online is to click anywhere in the row or...
Read more >How to Delete Records Using Delete in SQL [Updated]
The Syntax for Using the SQL Delete Command · The table from which we want to delete rows is specified in the table_name...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I implement the following function directly in the library and has worked very good
how to use, like “updateRow”
$(“#your-table”).bootstrapTable(‘removeRow’,{index:1});
I hope serves them (sorry for my English)
My Solution :