mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +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 %}
|
{% if missing and missing|length > 0 %}
|
||||||
<div class='alert alert-danger alert-block' role='alert'>
|
<div class='alert alert-danger alert-block' role='alert'>
|
||||||
Missing selections for the following columns:
|
Missing selections for the following required columns:
|
||||||
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
{% for col in missing %}
|
{% for col in missing %}
|
||||||
<li>{{ col }}</li>
|
<li>{{ col }}</li>
|
||||||
@ -30,18 +31,20 @@
|
|||||||
<th>Row</th>
|
<th>Row</th>
|
||||||
{% for col in bom_cols %}
|
{% for col in bom_cols %}
|
||||||
<th>
|
<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 }}'>
|
<select class='select' id='id_col_{{ forloop.counter0 }}' name='col_select_{{ forloop.counter0 }}'>
|
||||||
<option value=''>---------</option>
|
<option value=''>---------</option>
|
||||||
{% for req in req_cols %}
|
{% for req in req_cols %}
|
||||||
<option value='{{ req }}'{% if req == col.guess %}selected='selected'{% endif %}>{{ req }}</option>
|
<option value='{{ req }}'{% if req == col.guess %}selected='selected'{% endif %}>{{ req }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<option value='Delete'>Delete Column</option>
|
|
||||||
</select>
|
</select>
|
||||||
{% if col.duplicate %}
|
{% if col.duplicate %}
|
||||||
<p class='help-inline'>Duplicate column selection</p>
|
<p class='help-inline'>Duplicate column selection</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input type='hidden' name='col_name_{{ forloop.counter0 }}' value='{{ col.name }}'/>
|
|
||||||
{{ col.name }}
|
|
||||||
</th>
|
</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -767,9 +767,6 @@ class BomUpload(AjaxView, FormMixin):
|
|||||||
col_id = int(item.replace('col_select_', ''))
|
col_id = int(item.replace('col_select_', ''))
|
||||||
col_name = value
|
col_name = value
|
||||||
|
|
||||||
if value.lower() == 'delete':
|
|
||||||
continue
|
|
||||||
|
|
||||||
column_selections[col_id] = value
|
column_selections[col_id] = value
|
||||||
|
|
||||||
# Extract the row data
|
# 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) {
|
function loadBomTable(table, options) {
|
||||||
/* Load a BOM table with some configurable options.
|
/* Load a BOM table with some configurable options.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user