jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 61 through 75 (of 89 total)
  • Author
    Posts
  • in reply to: function is called twice function is called twice #68227

    cpuin
    Participant

    Dear Nadezda,

    This is the entire code.

    myWindow is a simply new window, that is not part of the jqxWidgets. Despite of this i have a problem with the addDialog, which i have already described.

    in reply to: can not get button work can not get button work #67305

    cpuin
    Participant

    I can’t believe that it solved my problem.

    Thank you!

    in reply to: update doesn't work update doesn't work #67270

    cpuin
    Participant

    Thank you for the support Dimitar.
    It was the server side, i have sent wrong variable.

    in reply to: update doesn't work update doesn't work #67175

    cpuin
    Participant

    I go this in the console: ReferenceError: Can’t find variable: Globalize
    The error thrown is: Syntax error: JSON parse error, unexpected identifier.

    It’s strange because i don’t expect any JSON.
    I moved the dunction outside the dataTable like this

    function saveInvoice(rowData) {
    			
    				var data = "insert=true&" + $.param(rowData);
    				$.ajax({
    				    dataType: 'json',
    				    url: 'json_documents.php',
    				    cache: false,
    				    data: data,
    				    success: function (data, status, xhr) {
    				        // update command is executed.
    				        //commit(true);
    				    },
    				    error: function (jqXHR, textStatus, errorThrown) {
    				        //commit(false);
    				        alert(errorThrown);
    				        }
    				       });
    			
    			}

    Because i want simply send data w/out updating the #dataTable.


    cpuin
    Participant

    I have no error.Just when returns null, the table stacks on “loading”

    in reply to: What is the right approach? What is the right approach? #65928

    cpuin
    Participant

    Now it works!

    in reply to: What is the right approach? What is the right approach? #65827

    cpuin
    Participant

    Now everything is OK.But i’m still looking for an answer of the question is this the right way to achieve this.I mean moderating the url and send it with GET?Because i also want the user to select whether some of the columns to be included or not, display only some users sales etc.

    in reply to: What is the right approach? What is the right approach? #65782

    cpuin
    Participant

    I have changed the code like this, unfortunately it doesn’t load nothing! In same time when manually trigger the url the PHP return right JSON:

    
    $("#startDate").jqxDateTimeInput({width: '200px', height: '25px', formatString: "yyyy-MM-dd"});
    	    
    	    
    	    $("#endDate").jqxDateTimeInput({width: '200px', height: '25px', formatString: "yyyy-MM-dd"});
    	    
    	    $("#submitButton").jqxButton({width: '100px', height: '25px'});
    	    $("#submitButton").mousedown(function() {
    	        		var start = $('#startDate').val();
    	        		var end = $('#endDate').val();
    	        		var url = 'json_sales.php?' + "startDate=" + start + "&endDate=" + end;
    	        		
    	        		var source =
    	        				{
    	        					datatype: "json",
    	        					datafields: [
    	        						{ name: 'GoodID', type: 'string'},
    	        						{ name: 'ObjectID', type: 'string'},
    	        						{ name: 'Qtty' , type: 'double'},
    	        						{ name: 'PriceOut' , type: 'double'},
    	        						{ name: 'UserID' , type: 'string'},
    	        						{ name: 'Total' , type: 'double'}
    	        					],
    	        					url: url,
    	        					cache: false,
    	        					addRow: function (rowID, rowData, position, commit) {
    	        					                    // synchronize with the server - send insert command
    	        					                    // call commit with parameter true if the synchronization with the server is successful 
    	        					                    // and with parameter false if the synchronization failed.
    	        					                    // you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB.
    	        					                    commit(true);
    	        					                },
    	        					updateRow: function (rowID, rowData, commit) {
    	        					           var data = "update=true&" + $.param(rowData);
    	        					           $.ajax({
    	        					               dataType: 'json',
    	        					               url: 'json_products.php',
    	        					               cache: false,
    	        					               data: data,
    	        					               success: function (data, status, xhr) {
    	        					                   // update command is executed.
    	        					                   commit(true);
    	        					               },
    	        					               error: function (jqXHR, textStatus, errorThrown) {
    	        					                   commit(false);
    	        					                   alert('Does not work :(');
    	        					                   }
    	        					                  });
    	        					                },
    	        					deleteRow: function (rowID, commit) {
    	        					                    // synchronize with the server - send delete command
    	        					                    // call commit with parameter true if the synchronization with the server is successful 
    	        					                    // and with parameter false if the synchronization failed.
    	        					                    commit(true);
    	        					                }
    	        				};
    	        				
    	        		 var dataAdapter = new $.jqx.dataAdapter(source);
    	        		 
    	        		$("#dataTable").jqxDataTable(
    	        		{
    	        		    width: 850,
    	        		    pageable: false,
    	        		    pagerButtonsCount: 10,
    	        		    source: dataAdapter,
    	        		    filterable: true,
    	        		    filtermode: 'simple',
    	        		    sortable: true,
    	        		    columnsResize: false,
    	        		    altRows: true,
    	        		    showAggregates: true,
    	        		    aggregatesHeight: 60,
    	        		    columns: [
    	        		    	//{ text: 'Acct', dataField: 'Acct', width: 100 },
    	        		        { text: 'Описание:', dataField: 'GoodID', width: 350 },
    	        		        //{ text: 'PartnerID', dataField: 'PartnerID', width: 350 },
    	        		        { text: 'Обект:', dataField: 'ObjectID', cellsFormat: 'f', width: 100 },
    	        		        { text: 'Потребител:', dataField: 'UserID', width:100},
    	        		        { text: 'К-во:', dataField: 'Qtty' , width: 100},
    	        		        { text: 'Цена:', dataField: 'PriceOut', width:100},
    	        		        { text: 'Общо:', dataField: 'Total', width:100, aggregates: [{
    	        		                                    'Total':
    	        		                                      function (aggregatedValue, currentValue, column, record) {
    	        		                                          var total = currentValue * parseInt(record['Qtty']);
    	        		                                          return aggregatedValue + total;
    	        		                                      }
    	        		                                }],
    	        		                                aggregatesRenderer: function (aggregates, column, element) {    
    	        		                                    var renderString = "<div style='margin: 4px; float: right;  height: 100%;'>";
    	        		                                    renderString += "<strong>Всичко: </strong>" + aggregates.Total + "<br><strong>С ДДС:</strong>" + (aggregates.Total*1.2) + "</div>";
    	        		                                    return renderString;
    	        		                                } }
    	        		        ]
    	        		        
    	        		});
    	        		//dataAdapter.dataBind();
    	        		//$("#dataTable").jqxDataTable('updateBoundData');
    	        		window.alert(url);
    	    });
    
    	    
    	    
    	    $("#excelExport").jqxButton();
    	                $("#xmlExport").jqxButton();
    	                $("#csvExport").jqxButton();
    	                $("#tsvExport").jqxButton();
    	                $("#htmlExport").jqxButton();
    	                $("#jsonExport").jqxButton();
    	                $("#excelExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'xls');
    	                });
    	                $("#xmlExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'xml');
    	                });
    	                $("#csvExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'csv');
    	                });
    	                $("#tsvExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'tsv');
    	                });
    	                $("#htmlExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'html');
    	                });
    	                $("#jsonExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'json');
    	                });
    	                
    	     $("#printButton").jqxButton({ width: 80 });
    	              
    	                $("#printButton").click(function () {
    	                     var gridContent = $("#dataTable").jqxDataTable('exportData', 'html');
    	                     var newWindow = window.open('', '', 'width=800, height=500'),
    	                     document = newWindow.document.open(),
    	                     pageContent =
    	                         '<!DOCTYPE html>' +
    	                         '<html>' +
    	                         '<head>' +
    	                         '<meta charset="utf-8" />' +
    	                         '<title>jQWidgets DataTable</title>' +
    	                         '</head>' +
    	                         '<body>' + gridContent + '</body></html>';
    	                     document.write(pageContent);
    	                     document.close();
    	                     newWindow.print();
    	                 });
    	    
    	    });
    
    in reply to: What is the right approach? What is the right approach? #65668

    cpuin
    Participant
    
    var url = 'json_sales.php';
    	    
    	    
    	    var source =
    	    		{
    	    			datatype: "json",
    	    			datafields: [
    	    				{ name: 'GoodID', type: 'string'},
    	    				{ name: 'ObjectID', type: 'string'},
    	    				{ name: 'Qtty' , type: 'double'},
    	    				{ name: 'PriceOut' , type: 'double'},
    	    				{ name: 'UserID' , type: 'string'},
    	    				{ name: 'Total' , type: 'double'}
    	    			],
    	    			url: url,
    	    			cache: false,
    	    			addRow: function (rowID, rowData, position, commit) {
    	    			                    // synchronize with the server - send insert command
    	    			                    // call commit with parameter true if the synchronization with the server is successful 
    	    			                    // and with parameter false if the synchronization failed.
    	    			                    // you can pass additional argument to the commit callback which represents the new ID if it is generated from a DB.
    	    			                    commit(true);
    	    			                },
    	    			updateRow: function (rowID, rowData, commit) {
    	    			           var data = "update=true&" + $.param(rowData);
    	    			           $.ajax({
    	    			               dataType: 'json',
    	    			               url: 'json_products.php',
    	    			               cache: false,
    	    			               data: data,
    	    			               success: function (data, status, xhr) {
    	    			                   // update command is executed.
    	    			                   commit(true);
    	    			               },
    	    			               error: function (jqXHR, textStatus, errorThrown) {
    	    			                   commit(false);
    	    			                   alert('Does not work :(');
    	    			                   }
    	    			                  });
    	    			                },
    	    			deleteRow: function (rowID, commit) {
    	    			                    // synchronize with the server - send delete command
    	    			                    // call commit with parameter true if the synchronization with the server is successful 
    	    			                    // and with parameter false if the synchronization failed.
    	    			                    commit(true);
    	    			                }
    	    		};
    	    		
    	     var dataAdapter = new $.jqx.dataAdapter(source);
    	     
    	     $("#dataTable").jqxDataTable(
    	     {
    	         width: 850,
    	         pageable: false,
    	         pagerButtonsCount: 10,
    	         source: dataAdapter,
    	         filterable: true,
    	         filtermode: 'simple',
    	         sortable: true,
    	         columnsResize: false,
    	         altRows: true,
    	         showAggregates: true,
    	         aggregatesHeight: 60,
    	         columns: [
    	         	//{ text: 'Acct', dataField: 'Acct', width: 100 },
    	             { text: 'Описание:', dataField: 'GoodID', width: 350 },
    	             //{ text: 'PartnerID', dataField: 'PartnerID', width: 350 },
    	             { text: 'Обект:', dataField: 'ObjectID', cellsFormat: 'f', width: 100 },
    	             { text: 'Потребител:', dataField: 'UserID', width:100},
    	             { text: 'К-во:', dataField: 'Qtty' , width: 100},
    	             { text: 'Цена:', dataField: 'PriceOut', width:100},
    	             { text: 'Общо:', dataField: 'Total', width:100, aggregates: [{
    	                                         'Total':
    	                                           function (aggregatedValue, currentValue, column, record) {
    	                                               var total = currentValue * parseInt(record['Qtty']);
    	                                               return aggregatedValue + total;
    	                                           }
    	                                     }],
    	                                     aggregatesRenderer: function (aggregates, column, element) {    
    	                                         var renderString = "<div style='margin: 4px; float: right;  height: 100%;'>";
    	                                         renderString += "<strong>Всичко: </strong>" + aggregates.Total + "<br><strong>С ДДС:</strong>" + (aggregates.Total*1.2) + "</div>";
    	                                         return renderString;
    	                                     } }
    	             ]
    	             
    	     });
    	    
    	    
    	    
    	    $("#startDate").jqxDateTimeInput({width: '200px', height: '25px', formatString: "yyyy-MM-dd"});
    	    
    	    
    	    $("#endDate").jqxDateTimeInput({width: '200px', height: '25px', formatString: "yyyy-MM-dd"});
    	    
    	    $("#submitButton").jqxButton({width: '100px', height: '25px'});
    	    $("#submitButton").mousedown(function() {
    	        		var start = $('#startDate').val();
    	        		var end = $('#endDate').val();
    	        		source.url = 'json_sales.php?' + "startDate=" + start + "&endDate=" + end;
    	        		dataAdapter.dataBind();
    	        		$("#dataTable").jqxDataTable('updateBoundData');
    	        		window.alert(source.url);
    	    });
    
    	    
    	    
    	    $("#excelExport").jqxButton();
    	                $("#xmlExport").jqxButton();
    	                $("#csvExport").jqxButton();
    	                $("#tsvExport").jqxButton();
    	                $("#htmlExport").jqxButton();
    	                $("#jsonExport").jqxButton();
    	                $("#excelExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'xls');
    	                });
    	                $("#xmlExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'xml');
    	                });
    	                $("#csvExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'csv');
    	                });
    	                $("#tsvExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'tsv');
    	                });
    	                $("#htmlExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'html');
    	                });
    	                $("#jsonExport").click(function () {
    	                    $("#dataTable").jqxDataTable('exportData', 'json');
    	                });
    	                
    	     $("#printButton").jqxButton({ width: 80 });
    	              
    	                $("#printButton").click(function () {
    	                     var gridContent = $("#dataTable").jqxDataTable('exportData', 'html');
    	                     var newWindow = window.open('', '', 'width=800, height=500'),
    	                     document = newWindow.document.open(),
    	                     pageContent =
    	                         '<!DOCTYPE html>' +
    	                         '<html>' +
    	                         '<head>' +
    	                         '<meta charset="utf-8" />' +
    	                         '<title>jQWidgets DataTable</title>' +
    	                         '</head>' +
    	                         '<body>' + gridContent + '</body></html>';
    	                     document.write(pageContent);
    	                     document.close();
    	                     newWindow.print();
    	                 });
    
    in reply to: What is the right approach? What is the right approach? #65627

    cpuin
    Participant

    Thank you for your answer.
    I changed it with your code.Unfortunately nothing happens.No data loads in the table.The url is correct, because i tested it and it returns correct JSON objects.

    in reply to: Input validator question Input validator question #65353

    cpuin
    Participant

    Meaninng like this:

    $("#addDialog").jqxWindow({
                                    resizable: false,
                                    isModal: true,
                                    position: { left: $("#dataTable").offset().left + 300, top: $("#dataTable").offset().top + 35 },
                                    width: 400, height: 270,
                                    autoOpen: false
                                    $("#addDialog").jqxValidator({
                                                    rules: [
                                                            
                                                            { input: "#_userPassword", message: "Password is required!", action: 'keyup, blur', rule: 'required' },
                                                            { input: "#_userPasswordConfirm", message: "Password is required!", action: 'keyup, blur', rule: 'required' },
                                                            {
                                                                input: "#_userPasswordConfirm", message: "Passwords should match!", action: 'keyup, blur', rule: function (input, commit) {
                                                                    var firstPassword = $("#_userPassword").jqxPasswordInput('val');
                                                                    var secondPassword = $("#_userPasswordConfirm").jqxPasswordInput('val');
                                                                    return firstPassword == secondPassword;
                                                                }
                                                            }
                                                    ],  hintType: "label"
                                                });
                                });
    

    i got an error:

    SyntaxError: Unexpected identifier ‘$’. Expected ‘}’ to end a object literal.

    in reply to: refresh cell value refresh cell value #62972

    cpuin
    Participant

    Thanks Peter!
    I tought there is a shorter way to update all items from the source istead to bind each of them.
    It works.

    in reply to: refresh cell value refresh cell value #62967

    cpuin
    Participant

    Dear Peter,

    updateRow requires new values! What i need is simply update the cell(if needed row) from the source

    in reply to: dataTable update dataTable update #62952

    cpuin
    Participant

    Problem solved.I was with the previous version of jqwidgets!
    After updating and clear the cache , now works!

    in reply to: dataTable update dataTable update #62947

    cpuin
    Participant

    Dear Petar,

    Sorry for the name.I didn’t make it on purpose.
    It’s pitty you can’t reproduce the problem, because without this expected behaviour the system i have planned to create will be impossible.

Viewing 15 posts - 61 through 75 (of 89 total)