Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jqwidget网格在设置新源后是否存在行不工作_Javascript_Jquery_Jqwidget - Fatal编程技术网

Javascript jqwidget网格在设置新源后是否存在行不工作

Javascript jqwidget网格在设置新源后是否存在行不工作,javascript,jquery,jqwidget,Javascript,Jquery,Jqwidget,这是我的网格代码。如果我设置了新数据源,然后单击“添加行”按钮,则日期选择器不工作 var source1; function populateCourierTable(data) { //alert("courier "+JSON.stringify(data)); source1 = { localdata : data, datafields : [ { name : 'courier_id',

这是我的网格代码。如果我设置了新数据源,然后单击“添加行”按钮,则日期选择器不工作

var source1;
function populateCourierTable(data) {
    //alert("courier "+JSON.stringify(data));
    source1 = {
        localdata : data,
        datafields : [ {
            name : 'courier_id',
            type : 'integer'
        }, {
            name : 'date',
            type : 'date'
        }, {
            name : 'name',
            type : 'string'
        }, {
            name : 'coming_from',
            type : 'string'
        }, {
            name : 'pod_no',
            type : 'string'
        }, {
            name : 'courier_name',
            type : 'string'
        }, {
            name : 'remark',
            type : 'string'
        }  ],
        datatype : "json",
        addrow: function (rowid, rowdata, position, commit) {
            //alert("add");
            //alert(JSON.stringify(rowdata));
            var rowdt=JSON.stringify(rowdata);

            $.ajax({
                type : 'POST',
                url : rootURL + '/addCourier',
                data: {
                    rowdt : rowdt
                },
                dataType : "json",
                success : function(data) {

                if(data == "success"){
                    alert("added successfully");
                    commit(true);
                }


                },
                error : function(res){
                    alert(JOSN.stingify(res));
                }
            });
        }
    };
    var dataAdapter = new $.jqx.dataAdapter(source1);
    $("#jqxgrid").jqxGrid({
        width : 1250,
        Height : 410,
        source : dataAdapter,
        //pageable : true,
        //showtoolbar : true,
        selectionmode : 'singlecell',
        columnsresize : true,
        sortable: true,
        // filterable: true,
        showeverpresentrow: true,
        everpresentrowposition: "top",
        everpresentrowactions: "add reset",
        // showfilterrow: true,
        // everpresentrowactionsmode: "columns",
        columns : [{
            text : 'Date',
            cellsformat : 'dd-MM-yyyy',
            filtertype : 'range',
            datafield : 'date',
            width : 170,
            createEverPresentRowWidget: function (datafield, htmlElement, popup, addCallback) {
                var inputTag = $("<div style='border: none;'></div>").appendTo(htmlElement);
                inputTag.jqxDateTimeInput({ value: null, popupZIndex: 99999999, placeHolder: "Enter Date: ", width: '100%', height: 30,formatString: 'dd-MM-yyyy' });
                $(document).on('keydown.date', function (event) {
                    if (event.keyCode == 13) {
                        if (event.target === inputTag[0]) {
                            addCallback();
                        }
                        else if ($(event.target).ischildof(inputTag)) {
                            addCallback();
                        }
                    }
                });
                return inputTag;
            },
            initEverPresentRowWidget: function (datafield, htmlElement) {
            },
            getEverPresentRowWidgetValue: function (datafield, htmlElement, validate) {
                var value = htmlElement.val();
                return value;
            },
            resetEverPresentRowWidgetValue: function (datafield, htmlElement) {
                htmlElement.val(null);
            }
        }, {
            text : 'Name',
            columntype : 'textbox',
            filtertype : 'input',
            datafield : 'name',
            width : 170
        }, {
            text : 'Coming From',
            columntype : 'textbox',
            filtertype : 'input',
            datafield : 'coming_from',
            width : 170
        }, {
            text : 'POD No',
            columntype : 'textbox',
            filtertype : 'input',
            datafield : 'pod_no',
            width : 170
        }, {
            text : 'Courier Name',
            columntype : 'textbox',
            filtertype : 'input',
            datafield : 'courier_name',
            width : 170
        }, {
            text : 'Remark',
            columntype : 'textbox',
            filtertype : 'input',
            datafield : 'remark',
            width : 170
        } ]
    });
    source1 = null;
    dataAdapter = null;
}

请回答我请添加一个JSFIDLE,它使事情更容易请回答我请添加一个JSFIDLE,它使事情更容易
$.ajax({
    type : 'POST',
    url : rootURL + "/filterData",
    data : {
        name : name,
        comingFrom : comingFrom,
        fromDate : fromDate,
        toDate : toDate,
        POD : POD,
        IDNo : IDNo,
        reportName : reportName,
        mobileNo : mobileNo
    },
    dataType : "json",
    success : function(data) {
        globalReportData = data;
         $('#jqxgrid').jqxGrid('refresh');
         source1.localdata = data;
        $("#jqxgrid").jqxGrid({ source: source1 });
    }
});