Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11565 closed defect (fixed)

dojox.data.util.JsonQuery producing broken sort syntax in query strings

Reported by: Nick Fenwick Owned by: Kris Zyp
Priority: high Milestone: 1.6
Component: DojoX Data Version: 1.5
Keywords: dojox jsonquery _toJsonQuery sort Cc:
Blocked By: Blocking:

Description

I have a DataGrid? using a JsonQueryRestStore? for data, pointing at my Java servlet for data. This had been working well with my custom Service object, but today I tried leaving out the 'service' attribute to JsonQueryRestStore?, so that it uses the default service instead. This causes it to use dojox.data.util.JsonQuery? to build the query sent to the backend, and I ran into this problem.

For example, I query by an attribute 'token', with a sort field 'configKey' and pagination turned on, for example I'm viewing a DataGrid? of my config data (which works fine before I try to sort) and click the Key column (field name 'configKey') to sort by that field.

You can simulate the query building with this JS:

var args = {
  count: 25,
  start: 25,
  isRender: false,
  query: { token: 'foobartokenwibble' },
  sort: [
    { attribute: 'configKey', descending: true }
  ],
  queryOptions: undefined
};
var jq = new dojox.data.util.JsonQuery();
jq._toJsonQuery(args, true);

The resulting string:

[?(@.token='foobartokenwibble')][\@['configKey'][25:50]

Note that 'configKey' is surrounded by mismatched square brackets.

Running this same code against dojo 1.4 (Google CDN) gives a correct result:

[?(@.token='foobartokenwibble')][\@['configKey']][25:50]

I doubt attaching a test case will make this clearer, but I will do so anyway :)

Attachments (2)

dojo15.html (1.1 KB) - added by Nick Fenwick 9 years ago.
Simple test case, uses google cdn.
11565.patch (563 bytes) - added by Nick Fenwick 9 years ago.
One-line fix to JsonQuery?.js to add the missing close square bracket

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by Nick Fenwick

Attachment: dojo15.html added

Simple test case, uses google cdn.

comment:1 Changed 9 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to Kris Zyp

Changed 9 years ago by Nick Fenwick

Attachment: 11565.patch added

One-line fix to JsonQuery?.js to add the missing close square bracket

comment:2 Changed 9 years ago by Nick Fenwick

I'm surprised this hasn't got any attention.. am I imagining things? :)

I just attached a one-liner fix, which I'm using locally and works for me.

comment:3 Changed 9 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [22845]) Closing bracket, fixes #11565

comment:4 Changed 9 years ago by bill

Milestone: tbd1.6
Note: See TracTickets for help on using tickets.