jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Browser zoom problem
Tagged: grid, sort, zoom factor
This topic contains 6 replies, has 4 voices, and was last updated by svetoslav_borislavov 2 years, 1 month ago.
-
AuthorBrowser zoom problem Posts
-
Hi
I use virtual scrolling in my jqxgrid to display a lot of data. Further i use the sort functionality.
This works great. But if i change the browser zoom to a different value than 100% some strange effects appear.
It isn’t possible anymore to sort a column and display other data than the first page(virtual scrolling). Every time i slide down the jqxgrid-slider the new data are requested, but after that the grid switch automatically back to the first view.If the browser zooming factor is 100% no problem occurs. (I tested this with firefox 44.0 and chrome 48.0).
Do you can help me?Adjusted example: I only add
sortable: true,
to the grid settings<!DOCTYPE html> <html lang="en"> <head> <title id='Description'>This example shows how to create a Grid from JSON data.</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqx-all.js"></script> <script type="text/javascript" src="../../scripts/gettheme.js"></script> <script type="text/javascript"> $(document).ready(function () { var theme = getTheme(); var url = "../sampledata/beverages.txt"; var parentsLength = $("#jqxWidget").parents().length; if (parentsLength > 3) { url = 'demos/sampledata/beverages.txt'; } // prepare the data var source = { datatype: "json", datafields: [ { name: 'name' }, { name: 'type' }, { name: 'calories', type: 'int' }, { name: 'totalfat' }, { name: 'protein' }, ], id: 'id', url: url }; var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true }); var records = dataAdapter.records; $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, theme: theme, columnsresize: true, virtualmode: true, sortable: true, rendergridrows: function (params) { var start = params.startindex; var end = params.endindex; var array = new Array(); for (i = start; i < end; i++) { array[i] = records[i]; } return array; }, columns: [ { text: 'Name', datafield: 'name', width: 250 }, { text: 'Beverage Type', datafield: 'type', width: 250 }, { text: 'Calories', datafield: 'calories', width: 180 }, { text: 'Total Fat', datafield: 'totalfat', width: 120 }, { text: 'Protein', datafield: 'protein', minwidth: 120 } ] }); }); </script> </head> <body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="jqxgrid"></div> </div> </body> </html>
Hi schueppi,
You do not use jQwidget’s current version. gettheme.js is not part of our package from 1+ years. I suggest you to use the latest version of the software.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI have the same problem with the latest version…
<!DOCTYPE html> <html lang="en"> <head> <title id='Description'>In this demo jqxGrid uses a virtualized scrolling which enables you to handle very large data sets without any impact on client side performance. The demo shows scrolling through 1 million records.</title> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqx-all.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var data = new Array(); var firstNames = [ "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene" ]; var lastNames = [ "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier" ]; var productNames = [ "Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist" ]; var priceValues = [ "2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0" ]; // generate sample data. var generatedata = function (startindex, endindex) { var data = {}; for (var i = startindex; i < endindex; i++) { var row = {}; var productindex = Math.floor(Math.random() * productNames.length); var price = parseFloat(priceValues[productindex]); var quantity = 1 + Math.round(Math.random() * 10); row["id"] = i; row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)]; row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)]; row["productname"] = productNames[productindex]; row["price"] = price; row["quantity"] = quantity; row["total"] = price * quantity; data[i] = row; } return data; } var source = { datatype: "array", localdata: {}, totalrecords: 1000000 }; // load virtual data. var rendergridrows = function (params) { var data = generatedata(params.startindex, params.endindex); return data; } var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 850, source: dataAdapter, virtualmode: true, sortable: true, rendergridrows: rendergridrows, columns: [ { text: 'Id', datafield: 'id', width: 100 }, { text: 'First Name', datafield: 'firstname', width: 120 }, { text: 'Last Name', datafield: 'lastname', width: 120 }, { text: 'Product', datafield: 'productname', width: 180 }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' }, { text: 'Total', datafield: 'total', cellsalign: 'right', cellsformat: 'c2' } ] }); }); </script> </head> <body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="jqxgrid"></div> </div> </body> </html>
Hi schueppi,
I see. When the column is sorted, this happends indeed. Unfortunately, there’s no workaround. I will create a work item for a future update.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter
Thank you very much for your reply.
Hope you will find the problem quickly.Best Regards
SchueppiHi, I’m facing the same issue. Has this been resolved in the later versions of jQWidgets?
Hi,
Can you update to the latest version and confirm whether the error still exists?
If so, please send us a demo.We are waiting for you!
Best Regards,
SvetoslavjQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.