jQuery UI Widgets Forums Grid ERROR DATE INTO GRID, Plis Help!

This topic contains 5 replies, has 2 voices, and was last updated by  RenoRain-Chile 10 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • ERROR DATE INTO GRID, Plis Help! #66637

    RenoRain-Chile
    Participant

    When trying to enter a date, either by a line programming or directly on the GRID, month always leaves zero.
    A Excepcion data already loaded via ajax bienen from an Oracle DB.

    I wish they could help me solve this.
    Greetings to all.

    Date is wrong
    Insert data Date in cell Grid

    ERROR DATE INTO GRID, Plis Help! #66667

    Dimitar
    Participant

    Hello RenoRain-Chile,

    The information you have provided is not sufficient for us to determine the source of the issue you experience. The posted images are not available, too. Please share links to the images and the relevant parts of your code so that we may be able to help you. Remember to format your code by selecting it and clicking the code button in the toolbar.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    ERROR DATE INTO GRID, Plis Help! #66711

    RenoRain-Chile
    Participant

    Ok.

    
    /* DATOS PARA GRID */
    		//var url = 
    
    			var	estructura_tabla_linea =
    					            {
    					                datatype: "json",
    					                async: true,
    					                type: "POST",
    					                cache: false,
    					                data: {
    								        identificador: function(){ return nrorendicion=$("#inputNRen").val().value},
    								        tecnico: datos_tecnico[0]
    								    },
    					                datafields: [
    					                    { name: 'zao_item', 	type: 'string' 	},
    					                    { name: 'zao_ndoc', 	type: 'string' 	},
    					                    { name: 'zao_fdcto', 	type: 'date',format:'dd/mm/yyyy'},
    					                    { name: 'zao_emisor', 	type: 'string' 	},
    					                    { name: 'zaf_desc', 	type: 'string' 	},
    					                    { name: 'zao_valor', 	type: 'int' 	},
    					                    { name: 'zao_mgasto', 	type: 'string' 	},
    					                    { name: 'zao_numos', 	type: 'string' 	},
    					                    { name: 'zao_obs', 		type: 'string' 	}
    					                ],
    			                root: "data",
    			                url: "./php_sql/lst_zao.php",
    		                    updaterow: function (rowid, rowdata, commit) {
    		                        // synchronize with the server - send update command
    		                        // call commit with parameter true if the synchronization with the server is successful 
    		                        // and with parameter false if the synchronization failed.
    		                        commit(true);	
    		                    },
    					                //url: "./php_sql/lst_zao.php?nrorendicion=" + $("#inputNRen").val()
    				            };
    
                var dataAdapter = new $.jqx.dataAdapter(estructura_tabla_linea, {
                    downloadComplete: function (data, status, xhr) { },
                    loadComplete: function (data) { },
                    loadError: function (xhr, status, error) { },
                })
    
    		$("#tabla_lineas").jqxGrid(
    		            {
    		                width: "99%",
    		                source: dataAdapter,                
    		                pageable: true,
    		                height: "99%",
    		                sortable: true,
    		                altrows: true,
    		                enabletooltips: true,
    		                editable: true,
    		                theme: "energyblue",
    		                localization: 'cl',
    		                selectionmode: 'singlerow',
    		                columns: [
    		                  { text: 'Item', 			columngroup: 'grpRendicion', datafield: 'zao_item', 	cellsalign: 'right', align: 'center', width: 050 ,editable:false},
    		                  { text: 'N° Doc', 		columngroup: 'grpRendicion', datafield: 'zao_ndoc', 	cellsalign: 'center', align: 'center', width: 090 },
    		                  //{ text: 'Fecha', 			columngroup: 'grpRendicion', datafield: 'zao_fdcto', 	cellsalign: 'right', align: 'center',cellsformat: 'dd/mm/yyyy', width: 100,type: 'date',format:'D' },
    		                  { text: 'Fecha', 			columngroup: 'grpRendicion', datafield: 'zao_fdcto', 	cellsalign: 'right', align: 'center',cellsformat: 'dd/mm/yyyy', width: 100,columntype: 'Date' },
    		                  { text: 'Emisor', 		columngroup: 'grpRendicion', datafield: 'zao_emisor', 	cellsalign: 'right', align: 'center',width: 160 },
    
    		                  { text: 'Tipo Doc', 		columngroup: 'grpRendicion', datafield: 'zaf_desc' ,	cellsalign: 'right', align: 'center',width: 200, columntype: 'dropdownlist',createeditor: function (row, value, editor) {
                                editor.jqxDropDownList({ source: dataZAF, placeHolder: "Tipo de Documento :",displayMember: 'zaf_desc', valueMember: 'zaf_serie' });},
    		                    geteditorvalue: function (row, cellvalue, editor) {
    		                          // return the editor's value.
    		                          return editor.val();
    		                    }
                              },
    		                  { text: 'Valor', 			columngroup: 'grpRendicion', datafield: 'zao_valor' ,	cellsalign: 'right' , align: 'center',width: 080, cellsformat: 'c2' },
    		                  { text: 'Motivo', 		columngroup: 'grpRendicion', datafield: 'zao_mgasto' ,	cellsalign: 'right',  align: 'center',width: 200, columntype: 'dropdownlist',createeditor: function (row, value, editor) {
                                editor.jqxDropDownList({ source: dataSX5, placeHolder: "Motivos :",displayMember: 'X5_DESCRI', valueMember: 'X5_CHAVE' });},
    		                    geteditorvalue: function (row, cellvalue, editor) {
    		                          // return the editor's value.
    		                          return editor.val();
    		                    }
                          	  },
    		                  { text: 'OS', 			columngroup: 'grpRendicion', datafield: 'zao_numos' ,	cellsalign: 'center', align: 'center',width: 150, columntype: 'dropdownlist',createeditor: function (row, value, editor) {
                                editor.jqxDropDownList({ source: dataAB6, placeHolder: "O. T. :",displayMember: 'AB6LISTADO', valueMember: 'AB6NUMOS' });},
    		                    geteditorvalue: function (row, cellvalue, editor) {
    		                          // return the editor's value.
    		                          return editor.val();
    		                    }
    		              	  },
    		                  { text: 'Observacion', 	columngroup: 'grpRendicion', datafield: 'zao_obs' ,		cellsalign: 'right' , align: 'center',width: 150 },
    		                ],
    		                columngroups: [
    		                    { text: 'Detalle de Rendiciones', align: 'center', name: 'grpRendicion' }
    		                ],
    					    showstatusbar: true,
    					    renderstatusbar: function (statusbar) {
                            $("#tabla_lineas").jqxGrid('autoresizecolumns');
                            $("#tabla_lineas").jqxGrid('refreshdata');
    
    						var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
    						                    var addButton = $("<div style='float: left; margin-left: 5px;'><img style='position: relative; margin-top: 2px;' src='./images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Incluir</span></div>");
    						                    var deleteButton = $("<div style='float: left; margin-left: 5px;'><img style='position: relative; margin-top: 2px;' src='./images/close.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Borrar</span></div>");
    						                    var reloadButton = $("<div style='float: left; margin-left: 5px;'><img style='position: relative; margin-top: 2px;' src='./images/refresh.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Refrescar</span></div>");
    						                    container.append(addButton);
    						                    container.append(deleteButton);
    						                    container.append(reloadButton);
    						                    statusbar.append(container);
    						                    addButton.jqxButton({  		width: 100, height: 20 });
    						                    deleteButton.jqxButton({  	width: 100, height: 20 });
    						                    reloadButton.jqxButton({  	width: 100, height: 20 });
    						                    //searchButton.jqxButton({  width: 50, height: 20 });
    											 // add new row.
    		                    addButton.click(function (event) {
    		                        //var datarow = generatedata(1);
    		                        $('html, body').animate({ scrollTop: $('#tabla_lineas').offset().top }, 'slow');
    		                        //FinGrid();
    		                        var cell = $('#tabla_lineas').jqxGrid('getrows');
    		                        //console.log(cell);
    		                        $('#tabla_lineas').jqxGrid({ selectedrowindex: (rowscount-1)});
    		                        var rowscount = $("#tabla_lineas").jqxGrid('getdatainformation').rowscount;
    		                        var selectedrowindex = $("#tabla_lineas").jqxGrid('getselectedrowindex');
    		                        if(isNaN(selectedrowindex)==true){
    		                        	selectedrowindex = rowscount-1;
    		                        };
    		                        var id = $("#tabla_lineas").jqxGrid('getrowid', selectedrowindex);
    		                        var id_next = parseInt(cell[selectedrowindex].zao_item)+1;
    		                        //console.log(id_next);
    		                        $("#tabla_lineas").jqxGrid('addrow', null, {});
    		                        var new_id = lpad(id_next,2);
    		                        //console.log(new_id);
    		                        var lLogico = false;
    		                        var i = 0;
    		                        var cell_value = '';
    		                        for( i=0 ; i<=(id_next-1) ; i++){
    		                        	cell_value = $('#tabla_lineas').jqxGrid('getcellvalue', i, "zao_item");
    		                        	if(cell_value==""||cell_value=== undefined){
    		                        		lLogico = $("#tabla_lineas").jqxGrid('setcellvalue', id_next-1, "zao_item", new_id);
    		                        		lLogico = $("#tabla_lineas").jqxGrid('setcellvalue', id_next-1, "zao_fdcto", $("#InputFRen").jqxDateTimeInput('getDate'));
    		                        	}
    		                    	}
    		                        /*
    		                        $.ajax($("#tabla_lineas").jqxGrid('setcellvalue', id_next-1, "zao_item", new_id),{
    	                        	   	'async':'false'
    	                        	});
    */
    		                    });
    		                    // delete selected row.
    		                    deleteButton.click(function (event) {
    		                        var selectedrowindex = $("#tabla_lineas").jqxGrid('getselectedrowindex');
    		                        var rowscount = $("#tabla_lineas").jqxGrid('getdatainformation').rowscount;
    		                        var id = $("#tabla_lineas").jqxGrid('getrowid', selectedrowindex);
    		                        $("#tabla_lineas").jqxGrid('deleterow', id);
    		                    });
    		                    // reload grid data.
    		                    reloadButton.click(function (event) {
    		                        $("#tabla_lineas").jqxGrid("updatebounddata");
    		                        var selectedrowindex = $("#tabla_lineas").jqxGrid('getselectedrowindex');
    		                        var rowscount = $("#tabla_lineas").jqxGrid('getdatainformation').rowscount;
    		                        $('#tabla_lineas').jqxGrid({ selectedrowindex: rowscount-1});
    		                    });
    		                    // search for a record.
    		                },
    		});
    		/* FIN GRID */
    		$("#tabla_lineas").jqxGrid('autoresizecolumns');
    
    ERROR DATE INTO GRID, Plis Help! #66712

    RenoRain-Chile
    Participant
    ERROR DATE INTO GRID, Plis Help! #66750

    Dimitar
    Participant

    Hi RenoRain-Chile,

    Your datafield format and column cellsformat have to be set to ‘dd/MM/yyyy’, not ‘dd/mm/yyyy’, because m stands for minutes and M – for month.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    ERROR DATE INTO GRID, Plis Help! #66766

    RenoRain-Chile
    Participant

    Excellent, that is, now works!.

    many Thanks
    regards

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.