Ticket #5753 (closed defect: worksforme)

Opened 10 months ago

Last modified 10 months ago

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
Severity: major Keywords: grid queryreadstore query refresh
Cc:

Description

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): ############

<html>
    <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.data.ItemFileReadStore");
            dojo.require("dojox.data.QueryReadStore");
            dojo.require("dojox.grid.Grid");
            dojo.require("dojox.grid.z_data.model");
            dojo.require("dijit.dijit");
            dojo.require("dojo.parser");  // scan page for widgets and instantiate them
        </script>
        
        <script type="text/javascript">
            
            // a grid view is a group of columns. 
            var view1 = {
                cells: 
                [
                    [
                        {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.
            }
            
        </script>
        
    </head>
    <body>
        <div class="heading">QueryReadStoreTest</div>
        <br />
        <div dojoType="dojo.data.ItemFileReadStore" id="IFR_Store" jsId="IFR_Store" url="QRStoreTestScript"></div>
        <div dojoType="dojox.data.QueryReadStore" id="QR_Store" jsId="QR_Store" url="QRStoreTestScript"></div>
        <div dojoType="dojox.grid.data.DojoData" 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()"/>
    </body>
</html>

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

##parameters=testAttribute=0
"""
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"}]}
  else:
    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

QRStoreTest.pt (2.8 kB) - added by guest 10 months ago.
Page Template
QRStoreTestScript.xpy (0.7 kB) - added by guest 10 months ago.
Test Script
5753.html (2.3 kB) - added by benschell 10 months ago.
Test file exhibits correct behavior.

Change History

Changed 10 months ago by guest

Page Template

Changed 10 months ago by guest

Test Script

Changed 10 months ago by peller

  • milestone changed from 1.0.3 to 1.1

Changed 10 months ago by peller

  • owner changed from bradneuberg to benschell
  • component changed from Storage/Flash to DojoX Grid

Changed 10 months ago by benschell

  • status changed from new to closed
  • resolution set to worksforme

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 10 months ago by benschell

Test file exhibits correct behavior.

Note: See TracTickets for help on using tickets.