current position:Home>Upload and preview pictures with JavaScript, and summarize the most complete mybatis core configuration file

Upload and preview pictures with JavaScript, and summarize the most complete mybatis core configuration file

2021-08-29 00:59:24 be on call

jqGrid Yes, it is ajax Implement the processing of requests and responses , Support local real-time refresh .

Two 、jqgrid characteristic


1、 By configuring url Address data display format

2、 Support line editing , Column search filter

3、 Support paging

4、 Add form to support file upload

5、 call chaining

3、 ... and 、 Code instance


1、jqgrid The page display


$(document).ready(function () {

    $("#gridTable").jqGrid({

        colNames:[' label ',' shift ', ' First class ', ' The second shift ', ' The third shift ', ' Fourth shift ',' operation '],

        colModel:[{

                name:'mark',

                index:'mark',

                width: 100,

            },{

                name:'division',

                index:'division',

                width: 100,

            },{

                name:'first_class',

                index:'first_class',

                width: 100,

            }, {

                name:'second_class',

                index:'second_class',

                width: 100,

            },{

                name:'third_class',

                index:'third_class',

                width: 100,

            }, {

                name: 'fouth_class',

                index: 'fouth_class',

                width: 100,

            }, {

                name: 'operate',

                index: 'operate',

                width: 200,

                search: false,

                formatter : function(cellvalue,options,rowObject){

                    var id = rowObject.mark

                    var str =   '<button class="btn-info" data-for="pictureModal">'+

                        ' picture '+

                        '</button>';

                    return str;

                },

            }

        ],

        sortname : "mark",

        sortorder : "desc",

        viewrecords : true,

        width: 747,

        height: 355,

        rowNum: 10,

        datatype: 'text',

        pager: "#gridPager",

        onSelectRow:function(rowid){

            grid_selectRow = $("#gridTable").jqGrid("getRowData",rowid);

            $("#modal_picture").pictureLoading({});

        },

        ondblClickRow: function(rowid) {

            grid_selectRow = $("#gridTable").jqGrid("getRowData",rowid);

            $("#edit").trigger("click");

        },

    });

 

    jf_initJqgrid();

    jf_click();

 

    function jf_initJqgrid(){

        $.ajax({

            url:"DivisiondefineServlet",

            async:true,   // Whether it is an asynchronous request 

            cache:false,  // Cache results 

            type:"GET",

            dataType:"json",

            success : function(data){

                $("#gridTable").jqGrid("clearGridData");

                for(var i=0;i<=data.length;i++){

                    $("#gridTable").jqGrid('addRowData',i+1,data[i]);

                }

            }

        })

    }

 

    $('[id^=jqgh_gridTable_]').css("height","20px");

 

    function jf_click() {

        $("#add").click(function () {

            $("#modal-divisionAdd").divisionAdd({});

        })

        $("#edit").click(function () {

            $("#modal-divisionEdit").divisionEdit({});

        })

        $("#delete").click(function () {

            jf_delete();

            jf_initJqgrid();

        })

    }

 

    function jf_delete() {

        $.ajax({

            url:"DivisiondefineServlet?action=delete",

            async:true,   // Whether it is an asynchronous request 

            cache:false,  // Cache results 

            type:"POST",

            dataType:"text",

            data :{

                "mark1" : grid_selectRow.mark,

            },

        })

    }

});


     
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141.
  • 142.
  • 143.
  • 144.
  • 145.
  • 146.
  • 147.
  • 148.
  • 149.
  • 150.
  • 151.
  • 152.
  • 153.
  • 154.
  • 155.
  • 156.
  • 157.
  • 158.
  • 159.
  • 160.
  • 161.
  • 162.
  • 163.
  • 164.
  • 165.
  • 166.
  • 167.
  • 168.
  • 169.
  • 170.
  • 171.
  • 172.
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183.
  • 184.
  • 185.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192.
  • 193.
  • 194.
  • 195.
  • 196.
  • 197.
  • 198.
  • 199.
  • 200.
  • 201.
  • 202.
  • 203.
  • 204.
  • 205.
  • 206.
  • 207.
  • 208.
  • 209.
  • 210.
  • 211.
  • 212.
  • 213.

2、 Module page


;(function($){

    $.fn.pictureLoading = function(options){

        var el = this;

        var opts = {

        }

        var param = $.extend(opts,options);

        var or = new Order(el, param);

    }

 

    var Order = function(el,param){

        this.el=el;

        this.param=param;

        this.orderContent();

        this.bindEvent();

        this.orderSetValue();

    }

 

    Order.prototype = {

        orderContent : function(){

            // Create a modal form 

            this.el.addClass("modal").attr("tabindex","-1").attr("data-backdrop","static");

            html=   '<div class="modal-dialog">'+

                        '<div class="modal-content" style="width: 450px">'+

                            '<div class="modal-header" style="border-bottom:0px;">'+

                                '<div class="row col-sm-12">'+

                                    '<div class="col-sm-8" align="left">'+

                                        '<span></span>'+

                                    '</div>'+

                                    '<div class="col-sm-4" align="right">'+

                                        '<button class="close" data-dismiss="modal" aria-hidden="true" value="HTML">'+

                                        '<span class="blue">×</span>'+

                                        '</button>'+

                                    '</div>'+

                                '</div>'+

                            '</div>'+

                            '<div class="modal-body" style="height:350px;top: -30px">'+

                                '<form id="form" action="PictureServlet" method="post">'+

                                    '<span> label </span><input id="mark" name="mark" disabled/>'+

                                    '<span id="FPicName">'+

                                    '<input id="IronMan" type="file" size="45" name="IronMan" class="avatar input" οnchange="loadfile(); "style="display:none";/>'+

                                    '<img id="viewImg" class="viewImg" src="picture/html.jpg" style="height: 300px;width: 400px;" ="loadPic();" >'+

                                    '</span>'+

                                '</form>'+

                            '</div>'+

                            '<div class="modal-footer">'+

                                '<div align="right">'+

                                    '<div class="btn-group">'+

                                        '<button id="btnSubCancel" class="btn btn-default btn-sm" data-dismiss="modal">'+

                                        '<span> sign out </span>'+

                                        '</button>'+

                                    '</div>'+

                                '</div>'+

                            '</div>'+

                        '</div>'+

                    '</div>';

            this.el.html("");

            this.el.append(html);

            this.el.modal("show");

        },

        orderSetValue : function(){

            $("#mark").val(grid_selectRow.mark);

            $.ajax({

                url:"PictureServlet",



#  Last 

** Friends in need [ You can get it for free by poking here ](https://gitee.com/vip204888/java-p7) This Daniel's study notes ~**

![ tencent T3 Daniel summed up 500 page MySQL The actual combat notes exploded unexpectedly ,P8 Read the call expert ](https://s2.51cto.com/images/20210824/1629761452553487.jpg)

![ tencent T3 Daniel summed up 500 page MySQL The actual combat notes exploded unexpectedly ,P8 Read the call expert ](https://s2.51cto.com/images/20210824/1629761452555954.jpg)
     
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.

copyright notice
author[be on call],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2021/08/20210829005921465q.html