mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Delete columns in-place using javascript
This commit is contained in:
parent
3c2f3c2c2c
commit
cfbfc6e258
@ -7,7 +7,8 @@
|
||||
|
||||
{% if missing and missing|length > 0 %}
|
||||
<div class='alert alert-danger alert-block' role='alert'>
|
||||
Missing selections for the following columns:
|
||||
Missing selections for the following required columns:
|
||||
<br>
|
||||
<ul>
|
||||
{% for col in missing %}
|
||||
<li>{{ col }}</li>
|
||||
@ -30,18 +31,20 @@
|
||||
<th>Row</th>
|
||||
{% for col in bom_cols %}
|
||||
<th>
|
||||
<input type='hidden' name='col_name_{{ forloop.counter0 }}' value='{{ col.name }}'/>
|
||||
{{ col.name }}
|
||||
<button class='btn btn-default btn-remove' id='del_col_{{ forloop.counter0 }}' title='Remove column'>
|
||||
<span col='col_{{ forloop.counter0 }}' onClick='removeColFromBomWizard()' class='glyphicon glyphicon-small glyphicon-remove'></span>
|
||||
</button>
|
||||
<select class='select' id='id_col_{{ forloop.counter0 }}' name='col_select_{{ forloop.counter0 }}'>
|
||||
<option value=''>---------</option>
|
||||
{% for req in req_cols %}
|
||||
<option value='{{ req }}'{% if req == col.guess %}selected='selected'{% endif %}>{{ req }}</option>
|
||||
{% endfor %}
|
||||
<option value='Delete'>Delete Column</option>
|
||||
<option value=''>---------</option>
|
||||
{% for req in req_cols %}
|
||||
<option value='{{ req }}'{% if req == col.guess %}selected='selected'{% endif %}>{{ req }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if col.duplicate %}
|
||||
<p class='help-inline'>Duplicate column selection</p>
|
||||
{% endif %}
|
||||
<input type='hidden' name='col_name_{{ forloop.counter0 }}' value='{{ col.name }}'/>
|
||||
{{ col.name }}
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
@ -767,9 +767,6 @@ class BomUpload(AjaxView, FormMixin):
|
||||
col_id = int(item.replace('col_select_', ''))
|
||||
col_name = value
|
||||
|
||||
if value.lower() == 'delete':
|
||||
continue
|
||||
|
||||
column_selections[col_id] = value
|
||||
|
||||
# Extract the row data
|
||||
|
@ -12,6 +12,25 @@ function reloadBomTable(table, options) {
|
||||
}
|
||||
|
||||
|
||||
function removeColFromBomWizard(e) {
|
||||
/* Remove a column from BOM upload wizard
|
||||
*/
|
||||
|
||||
e = e || window.event;
|
||||
|
||||
var src = e.target || e.srcElement;
|
||||
|
||||
// Which column was clicked?
|
||||
var col = $(src).closest('th').index();
|
||||
|
||||
var table = $(src).closest('table');
|
||||
|
||||
table.find('tr').each(function() {
|
||||
this.removeChild(this.cells[col]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loadBomTable(table, options) {
|
||||
/* Load a BOM table with some configurable options.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user