Note that there are some explanatory texts on larger screens.

plurals
  1. POdgrid and DateTextBox
    primarykey
    data
    text
    <p>I am trying to get a dgrid OnDemandGrid to work with dijit.form.DateTextBox as an editor. The data is fed to OnDemandGrid via JSON. Initially, I was trying to feed dates in the raw format from the MySQL database (e.g. <code>YYYY-MM-DD HH:MM:SS</code>), however when DateTextBox seemed incapable of parsing that string, I tried feeding it just the date (e.g. <code>2012-11-20</code>). However, this too failed to work.</p> <p>So, my primary issue is getting DateTextBox to process the date information. A secondary issue is how to deal with the time information, since DateTextBox cannot edit times. My current approach is that when I split the SQL date string, I am feeding dgrid the time as a separate column for a dijit.form.TimeTextBox. This seems like a messy solution, so I'm open to suggestions.</p> <p>Here's my grid code:</p> <pre><code>var grid = new declare([OnDemandGrid, Editor, Keyboard, Selection])({ store: store, query: {aid: "1900", action: "objectListGenerator2" }, bufferRows: 40, loadingMessage: "Loading...", columns: [ {field: "oid", label: "Object ID"}, Editor({field: "startDate", name: "Start Date", editorArgs: { selector: 'date', datePattern: 'yyyy-mm-dd', locale: 'en-us' }}, DateTextBox, "click"), Editor({field: "startTime", name: "Start Time"}, TimeTextBox, "click"), Editor({field: "endDate", name: "End Date"}, DateTextBox, "click"), Editor({field: "endTime", name: "End Time"}, TimeTextBox, "click"), {field: "endDateOid", label: "End OID"} ], }, "grid"); </code></pre> <p>Here's a sample string of my JSON source:</p> <pre><code>[{"content":"2012-11-20 18:12:00","oid":"2112","author":"","endDateOid":"2113","group":"","endTime":"17:59:00","poid":"0","id":null,"startTime":"18:12:00","gmt":"2012-11-22 00:12:43","name":"The Windows 8 Disaster Rolls On","paid":"1900","endDate":"2012-11-21","type":"startDate","startDate":"2012-11-20","cache":"","cachedate":"0000-00-00 00:00:00"}, {"content":"2013-01-01 17:59:00","oid":"2114","author":"","endDateOid":"2115","group":"","endTime":"16:59:00","poid":"0","id":1,"startTime":"17:59:00","gmt":"2012-11-22 00:14:49","name":"The Windows 8 Disaster Rolls On","paid":"1900","endDate":"2013-01-02","type":"startDate","startDate":"2013-01-01","cache":"","cachedate":"0000-00-00 00:00:00"}] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload