jQWidgets Forums
jQuery UI Widgets › Forums › Grid › grid Column not rendering date correctly
This topic contains 7 replies, has 2 voices, and was last updated by Yogesh Singh 11 years, 4 months ago.
-
Author
-
I have a grid definition below
$(“#divManageViewGrid”).jqxGrid(
{
width: ‘800’,
source: dataAdapter,
theme: TC.filters.manageViews.variables.theme,
altrows: true,
sortable: true,
pageable: true,
autoheight: true,
editable: true,
localization: TC.filters.manageViews.getLocalization(),
columns: [
{ text: ‘View ID’, datafield: ‘VIEW_ID’, hidden: true },
{ text: ‘View Name’, editable: false, datafield: ‘VIEW_NAME’, width: ‘200’ },
{ text: ‘Created By’, editable: false, datafield: ‘NAME’, width: ‘200’ },
{ text: ‘Modified Date’, editable: false, datafield: ‘CREATED_DATE’, width: ‘200’, cellsFormat: ‘MM/dd/yyyy HH:mm:ss’ },
{ text: ‘Default’, datafield: ‘DEFAULT_FLAG’, columntype: ‘checkbox’, width: ‘100’, cellsalign: ‘center’ },
{ text: ‘View Type’, datafield: ‘VIEW_TYPE’, hidden: true },
{
text: ‘Actions’,
width: ‘100’,
cellsalign: ‘center’,
cellsrenderer: function (row, column, value) {
var viewType = $(“#divManageViewGrid”).jqxGrid(‘getcellvalue’, row, ‘VIEW_TYPE’);
if (viewType == “Shared”) {
return ‘<input type=”button” class=”button-link-delete link” value=”Remove”/>’;
}
return ‘<input type=”button” class=”button-link link” value=”Edit”/>’
+ ‘<input type=”button” class=”button-link-delete link” value=”Delete”/>’;
}
}
]
});},
I have date with different time format but the grid renders only fixed hours i.e. 5 o clock and only sec component changes though in database date are of different hour and minutes components
Hi Yogesh,
The information is not sufficient for reproducing an issue. If you want someone to help you, then please provide a full sample which someone would be able to run, test and debug.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comi have this xml file that comes from the server
<NewDataSet>
<xs:schema id=”NewDataSet” xmlns=”” xmlns:xs=”http://www.w3.org/2001/XMLSchema” xmlns:msdata=”urn:schemas-microsoft-com:xml-msdata” xmlns:msprop=”urn:schemas-microsoft-com:xml-msprop”>
<xs:element name=”NewDataSet” msdata:IsDataSet=”true” msdata:MainDataTable=”View” msdata:UseCurrentLocale=”true”>
<xs:complexType>
<xs:choice minOccurs=”0″ maxOccurs=”unbounded”>
<xs:element name=”View” msdata:CaseSensitive=”False”>
<xs:complexType>
<xs:sequence>
<xs:element name=”VIEW_ID” msprop:OraDbType=”113″ type=”xs:long” minOccurs=”0″ />
<xs:element name=”VIEW_NAME” msprop:OraDbType=”126″ type=”xs:string” minOccurs=”0″ />
<xs:element name=”NAME” msprop:OraDbType=”126″ type=”xs:string” minOccurs=”0″ />
<xs:element name=”CREATED_DATE” msprop:OraDbType=”106″ type=”xs:dateTime” minOccurs=”0″ />
<xs:element name=”DEFAULT_FLAG” msprop:OraDbType=”126″ type=”xs:string” minOccurs=”0″ />
<xs:element name=”VIEW_TYPE” msprop:OraDbType=”126″ type=”xs:string” minOccurs=”0″ />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<View>
<VIEW_ID>79</VIEW_ID>
<VIEW_NAME>Jennifer J Contractors</VIEW_NAME>
<NAME>Jones,Jennifer</NAME>
<CREATED_DATE>2014-02-19T06:44:55-05:00</CREATED_DATE>
<DEFAULT_FLAG>FALSE</DEFAULT_FLAG>
<VIEW_TYPE>Shared</VIEW_TYPE>
</View>
<View>
<VIEW_ID>36</VIEW_ID>
<VIEW_NAME>Meena View</VIEW_NAME>
<NAME>Singh,Yogesh</NAME>
<CREATED_DATE>2014-02-19T06:45:01-05:00</CREATED_DATE>
<DEFAULT_FLAG>FALSE</DEFAULT_FLAG>
<VIEW_TYPE>Personal</VIEW_TYPE>
</View>
<View>
<VIEW_ID>103</VIEW_ID>
<VIEW_NAME>Test View</VIEW_NAME>
<NAME>Singh,Yogesh</NAME>
<CREATED_DATE>2014-02-19T06:47:44-05:00</CREATED_DATE>
<DEFAULT_FLAG>TRUE</DEFAULT_FLAG>
<VIEW_TYPE>Personal</VIEW_TYPE>
</View>
<View>
<VIEW_ID>100</VIEW_ID>
<VIEW_NAME>Yogesh View</VIEW_NAME>
<NAME>Singh,Yogesh</NAME>
<CREATED_DATE>2014-02-19T06:44:58-05:00</CREATED_DATE>
<DEFAULT_FLAG>FALSE</DEFAULT_FLAG>
<VIEW_TYPE>Personal</VIEW_TYPE>
</View>
</NewDataSet>This is the source variable
source:
{
datatype: “xml”,
datafields: [
{ name: ‘VIEW_ID’, type: ‘int’ },
{ name: ‘VIEW_NAME’, type: ‘string’ },
{ name: ‘NAME’, type: ‘string’ },
{ name: ‘CREATED_DATE’, type: ‘date’ },
{ name: ‘DEFAULT_FLAG’, type: ‘bool’ },
{ name: ‘VIEW_TYPE’, type: ‘string’ }
],
async: false,
root: “View”
},initializegrid: function (url, params) {
$.ajax({
type: ‘POST’,
dataType: ‘json’,
async: false,
url: url,
cache: false,
data: params,
contentType: ‘application/json; charset=utf-8’,
success: function (data) {
TC.filters.manageViews.variables.source.localdata = data.d;
TC.filters.manageViews.loadgrid();
},
error: function (err) {
alert(err.responseText);
}
});
},loadgrid: function () {
var dataAdapter = new $.jqx.dataAdapter(TC.filters.manageViews.variables.source);
// Manage view grid definition
$(“#divManageViewGrid”).jqxGrid(
{
width: ‘800’,
source: dataAdapter,
theme: TC.filters.manageViews.variables.theme,
altrows: true,
sortable: true,
pageable: true,
autoheight: true,
editable: true,
localization: TC.filters.manageViews.getLocalization(),
columns: [
{ text: ‘View ID’, datafield: ‘VIEW_ID’, hidden: true },
{ text: ‘View Name’, editable: false, datafield: ‘VIEW_NAME’, width: ‘200’ },
{ text: ‘Created By’, editable: false, datafield: ‘NAME’, width: ‘200’ },
{ text: ‘Modified Date’, editable: false, datafield: ‘CREATED_DATE’, width: ‘200’, cellsFormat: ‘MM/dd/yyyy HH:mm:ss’ }, //cellsformat: ‘<%=System.Globalization.CultureInfo.CurrentCulture.Name %>’ == “en-US” ? “MM/dd/yyyy h:mm:ss tt” : “dd/MM/yyyy h:mm:ss tt” },
{ text: ‘Default’, datafield: ‘DEFAULT_FLAG’, columntype: ‘checkbox’, width: ‘100’, cellsalign: ‘center’ },
{ text: ‘View Type’, datafield: ‘VIEW_TYPE’, hidden: true },
{
text: ‘Actions’,
width: ‘100’,
cellsalign: ‘center’,
cellsrenderer: function (row, column, value) {
var viewType = $(“#divManageViewGrid”).jqxGrid(‘getcellvalue’, row, ‘VIEW_TYPE’);
if (viewType == “Shared”) {
return ‘<input type=”button” class=”button-link-delete link” value=”Remove”/>’;
}
return ‘<input type=”button” class=”button-link link” value=”Edit”/>’
+ ‘<input type=”button” class=”button-link-delete link” value=”Delete”/>’;
}
}
]
});},
Hi Yogesh Singh,
I think that you should define the “format” property of the “date” member “2014-02-19T06:44:55-05:00” . Example: Example: { name: ‘SubmitDate’, type: ‘date’, format: “yyyy-MM-ddTHH:mm:ss-HH:mm” }
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comthank you for your reply Peter but still why am i seeing fixed hour and min as 5:00 even though in the xml i have dates with different hours and minutes
i tried to use
var cellsrrenderer = function (row, column, value) {
var formattedValue = $.jqx.dataFormat.formatdate(value, “d”)
return formattedValue;
};but when i debug the value parameter its coming with hour and minute component as 5:00
Hi Yogesh,
Did you use the approach which I suggested you? Would you mind posting the updated code?
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comYea it didnt work strangely but i have managed to get the solution by modifying the query itself but thanks anyways
-
AuthorPosts
You must be logged in to reply to this topic.