jQWidgets Forums
jQuery UI Widgets › Forums › Grid › localization of two grids on same page
Tagged: grid, jqxgrid, load element, loadtext, localization
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 11 years, 3 months ago.
-
Author
-
Hi
had two grids on same page and following is our localization …
Somehow right hand side grid (XYZ grid), still showing default “Loading” rather than showing “XYZ progress …”
$(‘#abcgrid’).jqxGrid({
……….
localization: getABCLocalization(),$(‘#xyzgrid’).jqxGrid({
……….
localization: getXYZLocalization(),var getABCLocalization = function () {
var localizationobj = {};localizationobj.loadtext = “<font color=’#AB1034′>ABC progress …</font>”;
localizationobj.emptydatastring = “ABC ABC”;return localizationobj;
}var getXYZLocalization = function () {
var localizationobj = {};localizationobj.loadtext = “<font color=’#AB1034′>XYZ progress …</font>”;
localizationobj.emptydatastring = “XYZ XYZ”;return localizationobj;
}Thanks
Hello mallepaddi,
We tested your sample and it works fine. The issue may originate elsewhere in your code.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/HI
Do you have a sample to look at it ?
Thanks
Hi mallepaddi,
Here is the example (based on the demo Default Functionality). Note that getXYZLocalization should be defined before initializing the grid.
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { var url = "../sampledata/products.xml"; var productNameUpdate = false; // prepare the data var source = { datatype: "xml", datafields: [ { name: 'ProductName', type: 'string' }, { name: 'QuantityPerUnit', type: 'int' }, { name: 'UnitPrice', type: 'float' }, { name: 'UnitsInStock', type: 'float' }, { name: 'Discontinued', type: 'bool' } ], root: "Products", record: "Product", id: 'ProductID', url: url, updaterow: function (rowid, newdata, 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. if (productNameUpdate == true) { commit(true); }; } }; var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties, rowdata) { if (value < 20) { return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; color: #ff0000;">' + value + '</span>'; } else { return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; color: #008000;">' + value + '</span>'; } } var dataAdapter = new $.jqx.dataAdapter(source, { downloadComplete: function (data, status, xhr) { }, loadComplete: function (data) { }, loadError: function (xhr, status, error) { } }); var getXYZLocalization = function () { var localizationobj = {}; localizationobj.loadtext = "<font color='#AB1034'>XYZ progress …</font>"; localizationobj.emptydatastring = "XYZ XYZ"; return localizationobj; } // initialize jqxGrid $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, pageable: true, autoheight: true, sortable: true, altrows: true, enabletooltips: true, editable: true, selectionmode: 'multiplecellsadvanced', localization: getXYZLocalization(), columns: [ { text: 'Product Name', columngroup: 'ProductDetails', datafield: 'ProductName', width: 250 }, { text: 'Quantity per Unit', columngroup: 'ProductDetails', datafield: 'QuantityPerUnit', cellsalign: 'right', align: 'right', width: 120 }, { text: 'Unit Price', columngroup: 'ProductDetails', datafield: 'UnitPrice', align: 'right', cellsalign: 'right', cellsformat: 'c2', width: 100 }, { text: 'Units In Stock', datafield: 'UnitsInStock', cellsalign: 'right', cellsrenderer: cellsrenderer, width: 100 }, { text: 'Discontinued', columntype: 'checkbox', datafield: 'Discontinued' } ], columngroups: [ { text: 'Product Details', align: 'center', name: 'ProductDetails' } ], ready: function () { $("#jqxgrid").jqxGrid("showloadelement"); } }); $("#jqxgrid").on('cellendedit', function (event) { var column = args.datafield; if (column == "ProductName") { productNameUpdate = true; } else { productNameUpdate = false; }; }); }); </script> </head> <body class='default'> <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> <div id="jqxgrid"> </div> </div> </body> </html>
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.