jQWidgets Forums
jQuery UI Widgets › Forums › DataTable › Hot to get properties of the jqxDataTable
This topic contains 5 replies, has 2 voices, and was last updated by Peter Stoev 11 years, 4 months ago.
-
Author
-
Dear Sir,
I’m new to your library,which I find very nice and useful.
Currently I’m testing it.
I was able to follow almost everything in your documentation,but something i can’t just figure out.
So this is my code:
$(‘#table’).jqxDataTable(
{
width: 300,
pageable: true,
pagerButtonsCount: 10,
source: adapter,
columnsResize: true,
columns: [
{ text: ‘Ime’, dataField: ‘ime’, width: 100 },
{text:’Pozicija’,dataField:’pozicija’,width:200}
]
});
So basically here what is bothering me is hot to get columns name,or other properties,e.g pageable,source or other.
Is there something like $(‘#table’).jqxDataTable(‘getParams’,’columns’) or similar.Please help me.
Thanks in advance.
Best regards,
Goran
P.S
Sorry for sending this question already in the jqxGrid Forum.
Hi Goran,
Here’s how to get a property of jqxDataTable:
Example:
var pageable = $(‘#table’).jqxDataTable('pageable');
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comDear Sir,
Thank you for your quick response.
After a little bit of researching,i finally figure it out.
Records was the key.
So with your help I was able to get what i was looking for.Wish you all the best.
Best regards
Goran
————–
Proposed solution to my own questionTo get property ‘columns’ of jqxDataTable we need this:
var col = $(‘#table’).jqxDataTable(‘columns’);
//get records
var records=col.records;
//in the example above we have two columns
//alert(records[0].text) –this prints ‘Ime’
////alert(records[0].width) –this prints 100With records we can easily see all the properties of ‘column’s (text,dataField,width etc) //we need to have some intelligent code completion
Hi Goran,
If you take a look at the jqxDataTable’s API page – http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdatatable/jquery-datatable-api.htm
then you will see the “getColumnProperty” method.$("#dataTable").jqxDataTable('getColumnProperty', 'firstName', 'width');
I do not suggest you to use internal API like columns.records in your applications and the correct way to use a widget is to stick to its documented API.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Dear Sir,
thank you for your reply.
I will take your suggestion,and use it,but still I’m not able to get my columns.
For me it does not work this code:———-
var cols = $(‘#table’).jqxDataTable(‘getColumnProperty’, ‘columns’). //can’t get my columns ,just tried on my machine
———
For other properties your suggestion works just fine.
So please can you show me an example how to get this columns, or can you give me some api link where i can
study this further.(other then provided in your previous post).
I also tried to play on http://jsfiddle.net/BX4Mc/4/ but no luck.Thank you.
Wish you all the best.
Best regards
Goran
Hi Goran,
As you can see from the syntax of the “getColumnProperty”, the method expects 2 parameters – column’s datafield and the column’s property. You cannot get the columns Array, you can get the property of any column.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.