Custom upload button

Custom upload button

jtoler5jtoler5 Posts: 93Questions: 34Answers: 3

I created a cell on each row that has a dropdown w/ move, duplicate, delete, and upload document. When I click upload document everything works correctly and the document is stored, etc. However, after I upload a document and click 'Save', if I turn around and click the 'New' button created by TableTools, I believe, it actually shows the upload dialog instead of all the columns needed for a new entry. If I refresh and click 'New' it loads the new entry modal perfectly and works. Below is the code to just show the document upload field for when the dropdown action 'upload' is clicked.

chargesTable.on( 'click', '.editor_upload', function (e) {
        e.preventDefault();
        editor
            .hide()
            .show('charges.documentId')
            .title( 'Upload Document' )
            .buttons({
                label: 'Save',
                fn: function () {
                    this.submit();
                }
            })
            .message('<div class="upload-message">For security reasons, PDF is only allowed to be uploaded.</div>')
            .edit($(this).closest('tr')[0]);
    });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Hi,

    So the issue here is that the other fields have been hidden and only the upload is shown - that persists even after the window you show with the above code is completed.

    You need to reshow the fields that you want to be visible. You could do that in open or a close chained to the above code - for example:

      .one( 'close', function () {
        editor.show();
      } );
    

    Allan

This discussion has been closed.