Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving a Dgrid JsonRest-based Store
    primarykey
    data
    text
    <p>I have a dgrid that has editable date fields. Above it, I have a "Save" button that calls <code>grid.save</code>. When I hit the button, it makes an XHR request back to the store's target, but does not provide any data back to the server for me to save (i.e. POST is empty). Right now it is hardwired to query item id 1900, as you can see in the code below.</p> <p>Here is how the store is initiated:</p> <pre class="lang-javascript prettyprint-override"><code> var store = new JsonRest({ target: "/safari/resources/1900/calendarObjects/", sortParam: "sort", idProperty: "id", properties: { startDate:{ format: "date-time" }, endDate:{ format: "date-time" } } }); </code></pre> <p>And here is the grid:</p> <pre class="lang-javascript prettyprint-override"><code> var grid = new declare([OnDemandGrid, dgridEditor, Keyboard, Selection, DijitRegistry])({ store: store, query: {responseType: "json" }, bufferRows: 40, loadingMessage: "Loading...", columns: [ {field: "oid", label: "Object ID"}, dgridEditor({field: "startDate", name: "Start Date", editorArgs: { selector: 'date', datePattern: 'yyyy-MM-dd', locale: 'en-us' }}, DateTextBox), dgridEditor({field: "startTime", name: "Start Time"}, TimeTextBox, "click"), dgridEditor({field: "endDate", name: "End Date"}, DateTextBox, "click"), dgridEditor({field: "endTime", name: "End Time"}, TimeTextBox, "click"), {field: "endDateOid", label: "End OID"} ], }, "grid"); </code></pre> <p>The save button looks like this:</p> <pre class="lang-javascript prettyprint-override"><code>registry.byId("saveButton").on("click", function (){ grid.save(); }); </code></pre> <p>Like I said, after I click "save," a new XHR request fires, but if it is sending any data back to the server, I'm not sure where it is going. I had my backend print up all of the HTTP headers it received and didn't see anything.</p> <p><strong>UPDATE (January 2, 2013):</strong> Upgraded server backend to use a traditional RESTful URL, which seems to make Dojo slightly happier, but it still is using <code>GET</code> instead of <code>PUT</code> and fails to actually send anything to save.</p> <p><strong>UPDATE (January 5, 2013):</strong> Is there any reason why JsonRest would call GET before calling PUT? I'm wondering if my program needs to return certain data before the program is willing to go do the PUT (and thus the problem isn't the GET but whatever comes next)... But, this is entirely speculation. I've reached a dead end. </p>
    singulars
    1. This table or related slice is empty.
    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