• Hi there and thanks for a good plugin. Need help in customization.

    I have the following table: https://profitov.net/tablitsa/ In the very last column there is an opportunity for user to upload the image file, just double click on it and push the “browse” button, then standard wordpress file uploader window appears, which is not good for me in this case.

    So I wish to replace it with our plugin dialoge, when user clicks on “Browse” it calls plugin file upload dialog. Can it be done?

    Will be very appreciate for help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author nickboss

    (@nickboss)

    Hi,

    When you double-click on the last cell the Browse-Ok buttons show up. Somehow, via custom javascript code, the cell (td element) is filled with these buttons. Do you know what is this code?

    Regards

    Nickolas

    Thread Starter T_ed

    (@t_ed)

    Hi, thanks for reply.
    I have asked my tables plugin support and here is their answer:

    The code that generates Browse button in New/Edit form is located in file ../wp-content/plugins/wpdatatables/templates/wpdatatables_table_main.inc.php from line 123

    <?php } elseif($dataColumn->getInputType() == 'attachment') { ?>
    
                    <button id="<?php echo $wpDataTable->getId() ?>_<?php echo $dataColumn_key ?>_button" data-column_type="<?php echo $dataColumn->getDataType();?>" data-input_type="<?php echo $dataColumn->getInputType(); ?>" data-rel_input="<?php echo $wpDataTable->getId() ?>_<?php echo $dataColumn_key ?>" class="btn fileupload_<?php echo $wpDataTable->getId() ?>"><?php _e('Browse','wpdatatables');?></button>
                    <input type="hidden" id="<?php echo $wpDataTable->getId() ?>_<?php echo $dataColumn_key ?>" data-key="<?php echo $dataColumn_key ?>" data-input_type="<?php echo $dataColumn->getInputType();?>" class="editDialogInput" />
    
                <div id="files_<?php echo $wpDataTable->getId() ?>_<?php echo $dataColumn_key ?>" class="files" style="width: 250px;"></div>

    Thread Starter T_ed

    (@t_ed)

    There is 2 ways to attach screenshot to the last cell.

    1. By double click on it, as you already know
    2. By clicking at any row, then clicking “New” and choosing “Browse” button there (at very bottom of window)
    Seems to me like the support answer refers more to second option. Or maybe bouth? I am not sure. Anyway if we can solve at least one part of it, that will be good.

    Thanks for your help.

    Plugin Author nickboss

    (@nickboss)

    Maybe the code is for both options, I do not know.

    The following is an experimental code, which should normally generate the plugin, in place of the Browse and Ok buttons. Put it in place of the above code. However I am not sure if it works. It is just for testing.

    <?php } elseif($dataColumn->getInputType() == 'attachment') { echo do_shortcode('[wordpress_file_upload]'); ?>
    
                <div id="files_<?php echo $wpDataTable->getId() ?>_<?php echo $dataColumn_key ?>" class="files" style="width: 250px;"></div>

    Nickolas

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Replacing standard wordpress upload dialoge by plugin dialoge’ is closed to new replies.