jQWidgets Forums

jQuery UI Widgets Forums Grid Date Column Format Issue

This topic contains 2 replies, has 2 voices, and was last updated by  aoverton07 11 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Date Column Format Issue #46742

    aoverton07
    Participant

    I cannot seem to get my date column to format properly. I have successfully been able to format dates in other grids but something isn’t working for me here:

    var reminderSource = {
    			url: "../urlToPHP.php",
    			datatype: 'json',
    			data: { action: 'reminders' },
    			datafield: [
    				{ name: 'title', type: 'string' },
    				{ name: 'category', type: 'string' },
    				{ name: 'start', type: 'date' }
    
    			]
    		}
    		
    		var reminderSourceAdapter = new $.jqx.dataAdapter(reminderSource);
    	
    		$("#remindersGrid").jqxGrid({
    			theme: theme, 
    			width: 600,
    			height: 200,
    			rowsheight: 20,
    			selectionmode: 'singlerow',
    			filterable: true,
    			columnsresize: true,
    			columnsreorder: true,
    			sortable: true,
    			editable: true,
    			source: reminderSourceAdapter,
    			columns: [
    				{ text: 'Date', datafield: "start", columntype: 'datetimeinput', cellsformat: "hh:mm tt", width: 150 },
    				{ text: 'Category', datafield: 'category', width: 100 },
    				{ text: 'Title', datafield: 'title', width: 300 }
    			]
    		});

    The start column in my MySQL database is of type datetime, do you know why the date is not formatting? (it’s coming in as shown in the db yyyy-mm-dd hh:mm:ss)

    Date Column Format Issue #46745

    Peter Stoev
    Keymaster

    Hi aoverton07,

    Sometimes, it is not enough to just set “cellsformat”. To set the format in your data source, you can do as it is shown in the Grid’s help docs – Example: { name: ‘SubmitDate’, type: ‘date’, format: “yyyy-MM-ddTHH:mm:ss-HH:mm” }

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Date Column Format Issue #46784

    aoverton07
    Participant

    Peter,

    Thanks for the advice I’ll make sure to do that as well. It turned out that in my source object I had typed “datafield” instead of “datafields”, im surprised it still worked!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.