How do I connect a django rest framework json query result to dgrid/OnDemandGrid

北战南征 提交于 2019-12-02 05:41:19

It looks like you're trying to use this service with dstore/Rest, but that has some specific expectations of the server request and response:

  • The response must report the list of items in one of the following ways:
    • Respond with a top-level array of items
    • Respond with an object with an items property whose value is an array of items
  • The response must report the total number of items in one of the following ways:
    • If the response is an object, you may include a total property in the object
    • Otherwise, you must include a Content-Range header (in the format X-Y/Z items, where the Z is of primary importance)
  • The request must support being informed of the range of items it should request out of the total result set via one of the following mechanisms:
    • start and count GET parameters (specified to the store instance via rangeStartParam and rangeCountParam)
    • Range headers (by setting useRangeHeaders: true)
    • Otherwise, by default, the store will pass a limit GET parameter in the format limit(count,start) (or just limit(count) if start is 0)

If your server can't fulfill these requirements (e.g. it sounds like it has quite different requirements regarding ranging, since it uses pages instead), you're going to need to think about extending/implementing a custom store.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!