如何在文件夹或任何jqgrid编辑添加对话框中上传文件

时间:2018-01-05 06:15:42

标签: php jquery jqgrid jqgrid-formatter jqgrid-php

我是Jqgrid的新手。如何上传特定文件夹中的图像或文件。 我尝试了大部分代码,但不明白如何使用 所以请帮帮我

{
   name: 'attachment',
   index: 'attachment',
   align: 'left',
   editable: true,
   edittype: 'file',
   editoptions: {
    enctype: "multipart/form-data"
     },
       width: 210,
       align: 'center',
       search: false
      },

  {name:'remarks',index:'remarks', width:250, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"50"}}
                        ],

                viewrecords : true,
                rowNum:10,
                rowList:[10,20,30],
                pager : pager_selector,
                altRows: true,
                //toppager: true,

                multiselect: true,
                //multikey: "ctrlKey",
                        multiboxonly: true,

                loadComplete : function() {
                    var table = this;
                    setTimeout(function(){
                        styleCheckbox(table);
                                                    updateActionIcons(table);
                        updatePagerIcons(table);
                        enableTooltips(table);


                    }, 0);


                },


                //editurl: "<? php cust_edit.php ?>",//nothing is saved

                                    //editurl: "<?php cust_edit.php ?>",
                                    editurl: "./call_logs_edit.php",//nothing is saved
                                    caption: "Call Logs",
                                    edit:true,
                                    add:true,
                                    del:true,
                                    multipleSearch:true,
                                    multipleGroup:true,
                                    //refresh: false,
                                    showQuery: true

                                    //reloadAfterSubmit: true
                                    //loadonce: false

                                    //,autowidth: true,


 /**
                ,
                grouping:true,
                groupingView : {
                     groupField : ['name'],
                     groupDataSorted : true,
                     plusicon : 'fa fa-chevron-down bigger-110',
                     minusicon : 'fa fa-chevron-up bigger-110'
                },
                caption: "Grouping"
 */

            });

                            $(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size


            //enable search/filter toolbar
            //jQuery(grid_selector).jqGrid('filterToolbar',{defaultSearch:true,stringResult:true})
            //jQuery(grid_selector).filterToolbar({});

                             /*
            //switch element when editing inline
            function aceSwitch( cellvalue, options, cell ) {
                setTimeout(function(){
                    $(cell) .find('input[type=checkbox]')
                        .addClass('ace ace-switch ace-switch-5')
                        .after('<span class="lbl"></span>');
                }, 0);
            }*/
            //enable datepicker
            function pickDate( cellvalue, options, cell ) {
                setTimeout(function(){
                    $(cell) .find('input[type=text]')
                        .datepicker({format:'yyyy-mm-dd' , autoclose:true});
                }, 0);
            }

                //navButtons
            jQuery(grid_selector).jqGrid('navGrid',pager_selector,
                {   //navbar options
                    edit: false,
                    editicon : 'ace-icon fa fa-pencil blue',
                    add: true,
                    addicon : 'ace-icon fa fa-plus-circle purple',
                    del: true,
                    delicon : 'ace-icon fa fa-trash-o red',
                    search: true,
                    searchicon : 'ace-icon fa fa-search orange',
                    refresh: false,
                    refreshicon : 'ace-icon fa fa-refresh green',
                    view: true,
                    viewicon : 'ace-icon fa fa-search-plus grey',
                },
                {
                    //edit record form
                    //closeAfterEdit: true,
                    //width: 700,
                    closeAfterEdit: true,
                                            reloadAfterSubmit : false,
                                            recreateForm: true,
                    beforeShowForm : function(e) {
                        var form = $(e[0]);
                        form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
                        style_edit2_form(form);
                    }
                        },
                        {
                    //new record form     // Add New Record in Add Form
                    width: 500,
                    closeAfterAdd: true,
                    recreateForm: true,
                    viewPagerButtons: false,
                                            reloadAfterSubmit : false,
                                            beforeShowForm : function(e) {
                        var form = $(e[0]);
                        form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar')
                        .wrapInner('<div class="widget-header" />')
                        style_edit_form(form);
                    }
                         },
                         {
                    //delete record form
                    recreateForm: true,
                    reloadAfterSubmit : false,
                    beforeShowForm : function(e) {
                        var form = $(e[0]);
                        if(form.data('styled')) return false;

                        form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />')
                        style_delete_form(form);

                        form.data('styled', true);
                    },
                    onClick : function(e) {
                        //alert(1);
                    }
                },

0 个答案:

没有答案