Opened 14 years ago

Closed 14 years ago

#5753 closed defect (worksforme)

Same query sent twice clears the Grid / QueryReadStore

Reported by: guest Owned by: benschell
Priority: high Milestone: 1.1
Component: DojoX Grid Version: 1.0
Keywords: grid queryreadstore query refresh Cc:
Blocked By: Blocking:


When using a Grid with queryReadStore and sending a new query via

      var model = dijit.byId("grid").model
      model.query = {testAttribute:dojo.byId("queryValue").value};
      model.refresh(); // Updates model data with store data.

it is supposed to fill the Grid with new data - which it does normally. If you resend the same query though (if "testAttribute" has the same value as sent before), it somehow clears the Grid and no further query succeeds in filling it with data again.

Using Dojo version: dojo-2008-01-31

############ Page Template (HTML/Zope): ############

    <head tal:define="dojoBaseURL container/dojoBaseURL10;">
        <title tal:content="template/title">The title</title>
        <link tal:replace="structure python:context.includeDojo10(context, debug_mode=False, parseWidgets=True)" />
        <!-- CSS Styles -->
        <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dojox/grid/z_grid/Grid.css" />
        <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dojox/grid/z_grid/tundraGrid.css" />
        <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dojo/resources/dojo.css" />
        <link rel="stylesheet" type="text/css" tal:attributes="href string:${dojoBaseURL}/dijit/themes/tundra/tundra.css" />
        <!-- Javascript -->
        <script type="text/javascript">
            dojo.require("dojo.parser");  // scan page for widgets and instantiate them
        <script type="text/javascript">
            // a grid view is a group of columns. 
            var view1 = {
                        {name: 'testCell_1',                field: "testCell_1"},
                        {name: 'testCell_2', width: "25em", field: "testCell_2"}
            // a grid layout is an array of views.
            var layout = [ view1 ];
            // get new Data for the Grid and show it.
            function gridDataUpdate(){
                var model = dijit.byId("grid").model
                model.query = {testAttribute:dojo.byId("queryValue").value};
                model.refresh(); // Updates model data with store data.
        <div class="heading">QueryReadStoreTest</div>
        <br />
        <div dojoType="" id="IFR_Store" jsId="IFR_Store" url="QRStoreTestScript"></div>
        <div dojoType="" id="QR_Store" jsId="QR_Store" url="QRStoreTestScript"></div>
        <div dojoType="" id="model" jsId="model" rowsPerPage="20" store="QR_Store" query="{}"></div>
        <div dojoType="dojox.Grid" id="grid" model="model" structure="layout" autowidth="true"></div>
        Query value: 
        <input name="queryValue" type="text" size="2" maxlength="2" value="1">
        <br />
        <input type="button" value="send Query" onclick="gridDataUpdate()"/>

############ QRStoreTestScript (Python/Zope?): ############

testing QueryReadStore in connection with new Dojo 1.0 Grid

from demjson import encode

def getResult(attribute):
  if attribute == "1":
    return {"identifier":"testCell_1","items":[{"testCell_1":"111","testCell_2":"111"},{"testCell_1":"112","testCell_2":"112"}]}
  if attribute == "2":
    return {"identifier":"testCell_1","items":[{"testCell_1":"222","testCell_2":"222"},{"testCell_1":"223","testCell_2":"223"}]}
    return {"identifier":"testCell_1","items":[{"testCell_1":"elseValue_1","testCell_2":"elseValue_2"},{"testCell_1":"elseValue_1a","testCell_2":"elseValue_2a"}]}

result = getResult(testAttribute)
return encode(result)

Attachments (3) (2.8 KB) - added by guest 14 years ago.
Page Template
QRStoreTestScript.xpy (683 bytes) - added by guest 14 years ago.
Test Script
5753.html (2.3 KB) - added by benschell 14 years ago.
Test file exhibits correct behavior.

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by guest

Attachment: added

Page Template

Changed 14 years ago by guest

Attachment: QRStoreTestScript.xpy added

Test Script

comment:1 Changed 14 years ago by Adam Peller


comment:2 Changed 14 years ago by Adam Peller

Component: Storage/FlashDojoX Grid
Owner: changed from bradneuberg to benschell

comment:3 Changed 14 years ago by benschell

Resolution: worksforme
Status: newclosed

Attached is a test page (to be placed alongside dojo/, etc.)

Re-executing the same query (A*, for instance) works fine for me. I did notice when copying/pasting some of the included test file that dojo.byId("queryValue") returns null, as the input box doesn't have an ID attached.

Marking as worksforme, I can't reproduce the bug. I tried the same test using an OpmlStore? instead and got the same results.

Changed 14 years ago by benschell

Attachment: 5753.html added

Test file exhibits correct behavior.

Note: See TracTickets for help on using tickets.