DataTables 1.9.3
DataTables 1.9.3
allan
Posts: 63,498Questions: 1Answers: 10,471 Site admin
Hello all,
I'm excited to announce that DataTables 1.9.3 is now available. Although this is a minor release of DataTables it is none-the-less important for the bug fixes that it includes and also one important new feature - mRender .
mRender is the compliment of the mData option (renamed in this release from mDataProp - this is a backwards compatible change! You can still use mDataProp, the reason for the renaming is for naming consistency and flexibility). mRender will be the subject of a blog post shortly, so I'll only summarise its abilities here, but basically it can replace fnRender with something that has far more ability.
mData, as described in this blog post, http://datatables.net/blog/Orthogonal_data , can be used to provide DataTables with different data for each cell data type, however, it has the added complication of needed to work with setting the data value - sometimes this can be useful, but often it just requires extra code. mRender does not need to consider the setting of data, just returning the data required for each type. This can take the form of a string or a function, just like mData and will use the value pointed to by mData and its base value (although it does have access to the full data source object if needed).
In addition to this the mData / mRender syntax as been expanded to include array notation for dealing with nested arrays. For example, if you had a JSON data source which looks like:
[code]
{
"name": "Allan",
"access": [
{ "id": 3, "name": "Printers" },
{ "id": 8, "name": "Scanner" },
{ "id": 6, "name": "Lab" }
]
}
[/code]
Previously, if you had wanted to simply put the `name` parameter from `access` into the DataTable, you would need to have created a mData function that would loop over the array, plucking out the parameter you want. Now however, what you can do is simply, for the column definition:
[code]
{
"mData": "access",
"mRender": "[, ].name"
}
[/code]
Note the mRender syntax - the square brackets indicate an array that will be traversed over (the `access` array, from on mData), while the `, ` in-between the two square brackets tells DataTables to concatenate the values found from the array with those two characters (i.e. we get a comma separated list) and finally the `.name` part picks up the `name` parameter from the objects in the array. Equally, you could just use an array of strings rather than an array of objects and not use objects in the `access` array.
This is all fairly deep stuff in DataTables, but this really enhances the abilities of DataTables and is why I'm excited about this 1.9.3 release. The power of the options presented by mData / mRender and the new array syntax will hopefully become more apparent with the release of Editor 1.2 shortly, which makes extensive use of this ability for working with complex data sets.
This latest release can be downloaded from the downloads page or directly with this link:
http://datatables.net/releases/DataTables-1.9.3.zip .
If you find any issues with this release, please open a new thread with a detailed description of the problem, so we can keep track of individual issues.
It takes a lot of time and effort to develop and support DataTables, so if you find it useful, please consider helping further support and development by making a donation towards the project: http://datatables.net/donate .
Enjoy!
Allan
I'm excited to announce that DataTables 1.9.3 is now available. Although this is a minor release of DataTables it is none-the-less important for the bug fixes that it includes and also one important new feature - mRender .
mRender is the compliment of the mData option (renamed in this release from mDataProp - this is a backwards compatible change! You can still use mDataProp, the reason for the renaming is for naming consistency and flexibility). mRender will be the subject of a blog post shortly, so I'll only summarise its abilities here, but basically it can replace fnRender with something that has far more ability.
mData, as described in this blog post, http://datatables.net/blog/Orthogonal_data , can be used to provide DataTables with different data for each cell data type, however, it has the added complication of needed to work with setting the data value - sometimes this can be useful, but often it just requires extra code. mRender does not need to consider the setting of data, just returning the data required for each type. This can take the form of a string or a function, just like mData and will use the value pointed to by mData and its base value (although it does have access to the full data source object if needed).
In addition to this the mData / mRender syntax as been expanded to include array notation for dealing with nested arrays. For example, if you had a JSON data source which looks like:
[code]
{
"name": "Allan",
"access": [
{ "id": 3, "name": "Printers" },
{ "id": 8, "name": "Scanner" },
{ "id": 6, "name": "Lab" }
]
}
[/code]
Previously, if you had wanted to simply put the `name` parameter from `access` into the DataTable, you would need to have created a mData function that would loop over the array, plucking out the parameter you want. Now however, what you can do is simply, for the column definition:
[code]
{
"mData": "access",
"mRender": "[, ].name"
}
[/code]
Note the mRender syntax - the square brackets indicate an array that will be traversed over (the `access` array, from on mData), while the `, ` in-between the two square brackets tells DataTables to concatenate the values found from the array with those two characters (i.e. we get a comma separated list) and finally the `.name` part picks up the `name` parameter from the objects in the array. Equally, you could just use an array of strings rather than an array of objects and not use objects in the `access` array.
This is all fairly deep stuff in DataTables, but this really enhances the abilities of DataTables and is why I'm excited about this 1.9.3 release. The power of the options presented by mData / mRender and the new array syntax will hopefully become more apparent with the release of Editor 1.2 shortly, which makes extensive use of this ability for working with complex data sets.
This latest release can be downloaded from the downloads page or directly with this link:
http://datatables.net/releases/DataTables-1.9.3.zip .
If you find any issues with this release, please open a new thread with a detailed description of the problem, so we can keep track of individual issues.
It takes a lot of time and effort to develop and support DataTables, so if you find it useful, please consider helping further support and development by making a donation towards the project: http://datatables.net/donate .
Enjoy!
Allan
This discussion has been closed.
Replies
P.S. I hope the guy who maintains the nuget package for datatables updates the package to 1.9.3.
http://nuget.org/packages/jquery.datatables
Allan
http://imgur.com/U13fx
Allan
https://www.dropbox.com/s/xg165464fresvt9/ff_whitespace.png
I am using JQuery 1.8 and JQuery UI 1.8.23. If I switch back to 1.9.2 the whitespace goes away.
I am trying to get a "live" version hosted, but the way our apps are configured it's a pain.
(Also, thanks Allan for your efforts. It's a great product)
*edit* Sorry - I see you say it does work in 1.9.2. If you could post in a new thread, so we can track this individual issue, and a link to a test case, please, that would be great.
Allan
The NuGet package for version 1.9.3 seems to be unusual. It does not install all extras as it used to do
Allan