⚡ NEW: Changeset/ - Full Archive

Changeset 3191132


Ignore:
Timestamp:
11/18/2024 10:59:54 AM (14 months ago)
Author:
nhrrob
Message:

Update to version 1.1.2-beta1 from GitHub

Location:
nhrrob-options-table-manager
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nhrrob-options-table-manager/tags/1.1.2-beta1/assets/js/admin.js

    r3179599 r3191132  
    1515
    1616        // Datatable display
    17         $('#nhrotm-data-table').DataTable({
     17        var table = $('#nhrotm-data-table').DataTable({
    1818            "processing": true,
    1919            "serverSide": true,
     
    9292        function editOption(id, $this) {
    9393            const row = $('#nhrotm-data-table').DataTable().row($($this).parents('tr')).data();
     94            let option_value;
    9495           
    9596            $('.nhrotm-edit-option-name').val(row.option_name);
    96             $('.nhrotm-edit-option-value').val(row.option_value.replace(/<div class="scrollable-cell">|<\/div>/g, ''));
     97            $('.nhrotm-edit-option-value').val('');
    9798            $('.nhrotm-edit-option-autoload').val(row.autoload);
    9899               
     
    102103            }
    103104
    104             $('.nhrotm-edit-option-modal').show();
    105 
     105            $.ajax({
     106                url: nhrotmOptionsTableManager.ajaxUrl,
     107                method: "POST",
     108                data: {
     109                    action: "nhrotm_get_option",
     110                    nonce: nhrotmOptionsTableManager.nonce,
     111                    option_name: row.option_name,
     112                },
     113                success: function(response) {
     114                    if (response.success) {
     115                        option_value = response.data.option_value ?? '';
     116                       
     117                        if (typeof response.data.option_value === 'object') {
     118                            option_value = JSON.stringify(option_value, null, 2);
     119                            $('.nhrotm-edit-option-value').val(option_value);
     120                        } else {
     121                            $('.nhrotm-edit-option-value').val(option_value);
     122                        }
     123
     124                        $('.nhrotm-edit-option-modal').show();
     125                    } else {
     126                        let message = response.data.message ?? 'Error: Failed to find option value';
     127                        // $('.nhrotm-edit-option-value').val(option_value);
     128                        alert(message);
     129                    }
     130                }
     131            });
     132           
    106133            $('.nhrotm-update-option').off('click').on('click', function() {
    107134                const optionName = $('.nhrotm-edit-option-name').val();