Reset file input when opening new part info.

pull/3/head
Davide Bongiovanni 6 years ago
parent 112686b9c6
commit 11b3ae1af5

@ -177,6 +177,10 @@ function show_part_info(partID) {
$('table#details tr#description td input').val(text_filter(data.description)); $('table#details tr#description td input').val(text_filter(data.description));
$('table#details tr#notes td p').text(text_filter(data.notes)); $('table#details tr#notes td p').text(text_filter(data.notes));
$('input[name=notes-input]').val(text_filter(data.notes)); $('input[name=notes-input]').val(text_filter(data.notes));
// Resetting file input. Super dirty hack. Disgusting
var $el = $('#datasheet-finput');
$el.wrap('<form>').closest('form').get(0).reset();
$el.unwrap();
container_onchange(); container_onchange();
if (data.datasheet != null) { if (data.datasheet != null) {
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>')); $('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
@ -243,9 +247,6 @@ function container_onchange() {
} }
} }
function octopartFetch(){ function octopartFetch(){
$.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){ $.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){
if (json['result']=='ok'){ if (json['result']=='ok'){

Loading…
Cancel
Save