jQuery UI Widgets › Forums › Grid › Knockout inline binding – date formatting
Tagged: cellsformat, data adapter, date, formatting, grid, inline, jqxgrid, Knockout
This topic contains 1 reply, has 2 voices, and was last updated by Dimitar 10 years, 5 months ago.
-
Author
-
Hey there,
I have a grid that I’m binding with knockout and would like to format the date fields like so (‘ 27-Jun-2014 ‘).
If you could help me to solve this or point me in the right direction I would appreciated.Here is my grid definition:
<div id="jqxgrid" class="gridClass" style="margin-left: 10px; margin-right:10px" data-bind="jqxGrid: { source: users, editable: false, sortable: true, selectionmode: 'singlerow', theme: 'bootstrap', height: 300, columnsresize: true, width: '99%', altrows: true, enabletooltips: true, columns: [ { text: 'User Id', dataField: 'UserId', hidden: true }, { text: 'Login ID', dataField: 'UserName' }, { text: 'Full Name', dataField: 'UserFullName' }, { text: 'Enabled', dataField: 'IsApproved', columntype: 'checkbox', width: 60 }, { text: 'Locked Out', dataField: 'IsLockedOut', columntype: 'checkbox', width: 60 }, { text: 'Email', dataField: 'Email' }, { text: 'Creation Date', dataField: 'CreateDate', cellsformat: 'dd-MMM-yyyy' }, { text: 'Login Date', dataField: 'LastLoginDate', type: 'date', cellsformat: 'dd-MMM-yyyy' }, { text: 'Last Activity Date', dataField: 'LastActivityDate', cellsformat: 'dd-MMM-yyyy', hidden: true }, { text: 'Last Password Changed Date', dataField: 'LastPasswordChangedDate', cellsformat: 'dd-MMM-yyyy', hidden: true } ]}">
I have accomplished this before with a data adapter by defining the datafield as a type:’date’ in the datasource and then adding a cellsformat: ‘dd-MMM-yyy’.
Again I would like to keep the grid defined as is and not use a data adapter.P.S.
Why is it that there is no search feature within in forum section? There is only a search available for the overall forum.
Would make it easier to search for question similar to mine before submitting a question.Hello jr,
You would have to use data adapter so that the grid interprets the data in this column as date and not string. The only other option is to keep it this way but implement cellsrenderer which to return re-formatted dates.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.