jQuery UI Widgets › Forums › Grid › JQXGrid columngroups coumns text change dynamcially
Tagged: Angular, change text, grid, jqxgrid, scope, setcolumnproperty, text
This topic contains 3 replies, has 2 voices, and was last updated by Nadezhda 9 years, 7 months ago.
-
Author
-
columngroups: [
{ text: ‘Work Space Name’, align: ‘center’, dataField:’WorkSpace’, name: ‘WorkSpace’ },
{ text: ‘Rating Task’, align: ‘center’, name: ‘TaskGrouping’ }
]how to change “text: ‘Work Space Name'” name dynamically. I have tried with setcolumnproperty, but it’s not working.
Thanks,
Prasad.Hello Prasad,
Please, find the following example which shows how to change dynamically the text of ‘columngroups’:
<!DOCTYPE html> <html lang="en"> <head> <title></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/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/jqxgrid.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsresize.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsreorder.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxpanel.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"> $(document).ready(function () { // prepare the data var source = { datatype: "xml", datafields: [ { name: 'SupplierName', type: 'string' }, { name: 'Quantity', type: 'number' }, { name: 'OrderDate', type: 'date' }, { name: 'OrderAddress', type: 'string' }, { name: 'Freight', type: 'number' }, { name: 'Price', type: 'number' }, { name: 'City', type: 'string' }, { name: 'ProductName', type: 'string' }, { name: 'Address', type: 'string' } ], url: '../sampledata/orderdetailsextended.xml', root: 'DATA', record: 'ROW' }; var dataAdapter = new $.jqx.dataAdapter(source, { loadComplete: function () { } }); // create jqxgrid. $("#jqxgrid").jqxGrid( { width: 850, source: dataAdapter, pageable: true, autorowheight: true, altrows: true, columnsresize: true, columns: [ { text: 'Supplier Name', cellsalign: 'center', align: 'center', datafield: 'SupplierName', width: 110 }, { text: 'Name', columngroup: 'ProductDetails', cellsalign: 'center', align: 'center', datafield: 'ProductName', width: 120 }, { text: 'Quantity', columngroup: 'ProductDetails', datafield: 'Quantity', cellsformat: 'd', cellsalign: 'center', align: 'center', width: 80 }, { text: 'Freight', columngroup: 'OrderDetails', datafield: 'Freight', cellsformat: 'd', cellsalign: 'center', align: 'center', width: 100 }, { text: 'Order Date', columngroup: 'OrderDetails', cellsalign: 'center', align: 'center', cellsformat: 'd', datafield: 'OrderDate', width: 100 }, { text: 'Order Address', columngroup: 'OrderDetails', cellsalign: 'center', align: 'center', datafield: 'OrderAddress', width: 100 }, { text: 'Price', columngroup: 'ProductDetails', datafield: 'Price', cellsformat: 'c2', align: 'center', cellsalign: 'center', width: 70 }, { text: 'Address', columngroup: 'Location', cellsalign: 'center', align: 'center', datafield: 'Address', width: 120 }, { text: 'City', columngroup: 'Location', cellsalign: 'center', align: 'center', datafield: 'City', width: 80 } ], columngroups: [ { text: 'Product Details', align: 'center', name: 'ProductDetails' }, { text: 'Order Details', parentgroup: 'ProductDetails', align: 'center', name: 'OrderDetails' }, { text: 'Location', align: 'center', name: 'Location' } ] }); $("#jqxbutton").jqxButton({ width: 320, height: 30 }); $('#jqxbutton').click(function () { $("#jqxgrid").jqxGrid({ columngroups: [ { text: 'New Product Details', align: 'center', name: 'ProductDetails' }, { text: 'New Order Details', parentgroup: 'ProductDetails', align: 'center', name: 'OrderDetails' }, { text: 'New Location', align: 'center', name: 'Location' } ] }); }); }); </script> </head> <body class='default'> <div id="jqxgrid"> </div> <input type="button" style="margin: 10px;" id="jqxbutton" value="Change text" /> </body> </html>
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/HI ream,
please check my requirement below,$scope.bindingComplete = function (event) {
$scope.listBoxSettings.apply(‘selectIndex’, 0);
var item = $(“#jqxMedicalList”).jqxListBox(‘getSelectedItem’);
var SelectedLableName = item.label;
selvalue = item.value;
alert(selvalue);
updateGrid(selvalue);$(“#jqxTaskNode”).jqxGrid({
columngroups: [
{ text: SelectedLableName, align: ‘center’, name: ‘WorkSpace’ },
{ text: ‘Rating Task’, align: ‘center’, name: ‘TaskGrouping’ }
]
});
}please tell me how to add dynamic value with parameters in columngroups.
Thanks,
Prasqad.Hi Prasad,
Please, refer to the following forum topic: http://www.jqwidgets.com/community/topic/jqx-watch-issue/. Also you can look at Angular demo page.
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.