1

我正在尝试将文件上传器添加到一个可编辑的 jquery dataTable (http://code.google.com/p/jquery-datatables-editable/)

我尝试在表单中添加一个 div,但fineUploader 保留了上次操作的状态。

$(document).ready(function() {
       $('#fine-uploader').fineUploader({
               request: {
                  endpoint: ...

<form id="formAddNewMedia" action="#" title="Agregar un elemento">
<div id="fine-uploader"></div>
<label for=....

有一种方法可以将所有 UI 元素重置为它们在初始化后立即存在的状态......但我认为 fileUploader 应该使用表单激活构建并在它关闭后销毁。

类似于回调 fnOnAddNewRow 的东西:

 var oTable = $('#media_table').dataTable({
        "sScrollY": "200px",
        "bScrollCollapse": true,
        "bPaginate": false,
        "sAjaxSource": "/ajax_library_media.txt",
        "bProcessing": true,
        "oLanguage": {
            "sUrl": "assets/js/dataTables.spanish.txt"
        },
        "bJQueryUI" : true
        }).makeEditable({

        sUpdateURL: "update_media.php",
                    sAddURL: "add_media.php",
                    fnOnAddNewRow (function() {
                        $('#fine-uploader').fineUploader({
                        request: {
                        endpoint: ...

我认为可以在 jquery.dataTables.editable.js 中添加

        //Setup form to open in dialog
        oAddNewRowForm = $("#" + properties.sAddNewRowFormId);
        if (oAddNewRowForm.length != 0) {
            if (properties.oAddNewRowFormOptions != null) {
                properties.oAddNewRowFormOptions.autoOpen = false;
            } else {
                properties.oAddNewRowFormOptions = { autoOpen: false };
            }
            oAddNewRowForm.dialog(properties.oAddNewRowFormOptions);

            //Add button click handler on the "Add new row" button
            oAddNewRowButton = $("#" + properties.sAddNewRowButtonId);
            if (oAddNewRowButton.length != 0) {
                oAddNewRowButton.click(function () {
                    oAddNewRowForm.dialog('open');

                });
            } else {
                if ($(properties.sAddDeleteToolbarSelector).length == 0) {
                    throw "Cannot find a button with an id '" + properties.sAddNewRowButtonId + "', od placeholder with an id '" + properties.sAddDeleteToolbarSelector + "' that should be used for adding new row although form for adding new record is specified";
                } else {
                    oAddNewRowButton = null; //It will be auto-generated later
                }
            }

使用 oAddNewRowForm.dialog('open'); 打开对话框的位置

任何人都有节省睡眠的想法?!

4

0 回答 0