I think this is a bug of Store

  1. #1

    I think this is a bug of Store

        <ext:Store runat="server" ID="Store1" AutoLoad="false" OnRefreshData="Store1_RefreshData" SerializationMode="Simple">
            <AutoLoadParams>
                <ext:Parameter Name="Start" Value="={0}" />
                <ext:Parameter Name="Count" Value="={3}" />
            </AutoLoadParams>
            <Proxy>
                <ext:DataSourceProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader ReaderID="ID">
                    <Fields>
                        <ext:RecordField Name="ID" />
                        <ext:RecordField Name="Name" />
                        <ext:RecordField Name="ImageMiniURI">
                            <Convert Fn="ClientUrl" />
                        </ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
                                                <ext:ComboBox ID="ComboBox1" runat="server" StoreID="Store1" DisplayField="Name"
                                                    ForceSelection="true" Mode="Remote" ValueField="ID" TypeAhead="false" LoadingText="???,???..."
                                                    Width="570" EmptyText="?????,???????" FireSelect&#111;nload="true" PageSize="5" HideTrigger="true"
                                                    ItemSelector="div.search-item" MinChars="2" MaxHeight="600px">
                                                    <Listeners>
                                                        <Select Handler="window.location='SelfService.aspx?MouldID='+this.value;new Ext.LoadMask(Ext.getBody(), {msg:'??? ...'}).show()" />
                                                    </Listeners>
                                                    <Template ID="Template1" runat="server">
                                               <tpl for=".">
                                                  <div class="search-item">
                                                  
                                                      <h3>{Name}</h3>
                                                      <img alt="{Name}" src="{ImageMiniURI}" />
                                                  
    
                                               </tpl>
                                                    </Template>
                                                </ext:ComboBox>
            protected void Store1_RefreshData(object sender, Coolite.Ext.Web.StoreRefreshDataEventArgs e)
            {
                string query = e.Parameters["query"];
    
                if (!string.IsNullOrEmpty(query))
                {
                    e.TotalCount = BLL.Common.CardDataWay.Count<Entities.SelfMould>(Entities.SelfMould._.Name.Contains(query));
                    this.Store1.DataSource = BLL.Common.CardDataWay.From<Entities.SelfMould>().Where(Entities.SelfMould._.Name.Contains(query)).ToArray<Entities.SelfMould>(e.Limit, e.Limit * e.Start);
                    this.Store1.DataBind();
                }
            }

    if the first query no result
    after,all of query will no result both

    first query post
    submitAjaxEventConfig{"config":{"extraParams":{"start":0,"limit":5,"query":"no_result_key"}}}
    first query response

    {serviceResponse:{Success:true},script:"WindowSite.close();"}

    after query post
    submitAjaxEventConfig{"config":{"extraParams":{"start":0,"limit":5,"query":"00"}}}
    after query response
    {serviceResponse:{Data:{data:[{"Name":"BD-0053","ImageMiniURI":"~/Files/ProductImages/e942270f-e8f0-49f9-bf8f-d2453213ed21_mini
    .jpg","ID":"0481f984-2033-471f-a066-fafc6197f275"},{"Name":"BD-0038","ImageMiniURI":"~/Files/ProductImages
    /e29481d6-be3c-4505-8745-593ad90508e7_mini.jpg","ID":"0d05e663-1342-4752-b267-e446ff1080bb"},{"Name"
    :"BD-0065","ImageMiniURI":"~/Files/ProductImages/7755209c-3dfa-4957-82c7-be21cababedb_mini.jpg","ID"
    :"0fbb9c98-6fcd-44ad-853a-a4f85d3c26f1"},{"Name":"KL-0009","ImageMiniURI":"~/Files/ProductImages/b2a96d33-a0cb-44f2-a3b1-9ed198ee4c90_mini
    .jpg","ID":"17dd6e9b-dc0b-498f-825a-1d538c502bf8"},{"Name":"FC-0025","ImageMiniURI":"~/Files/ProductImages
    /96ed2f4a-5377-44a7-94ae-3baaeb3ddcbc_mini.jpg","ID":"199c5ce7-a3c3-4871-9340-3a65d2a6cbab"}], totalCount
    : 497},Success:true},script:"WindowSite.close();"}
    data return right,but no bind with combobox or store
  2. #2

    RE: I think this is a bug of Store

    The uppercase "Success:true" the response seems a bit strange. I think it should be "success:true".

    I am going to try and reproduce.

    Geoffrey McGill
    Founder
  3. #3

    RE: I think this is a bug of Store

    why the response not contain "Data:{data:[*],totalCount:n}" when the result is empty

    Temporary solution
            protected void Store1_RefreshData(object sender, Coolite.Ext.Web.StoreRefreshDataEventArgs e)
            {
                string query = e.Parameters["query"];
    
                if (!string.IsNullOrEmpty(query))
                {
                    e.TotalCount = BLL.Common.CardDataWay.Count<Entities.SelfMould>(Entities.SelfMould._.Name.Contains(query));
                }
                else
                {         
                    e.TotalCount = 0;
                }
                if (e.TotalCount > 0)
                {
                    this.Store1.DataSource = BLL.Common.CardDataWay.From<Entities.SelfMould>().Where(Entities.SelfMould._.Name.Contains(query)).ToArray<Entities.SelfMould>(e.Limit, e.Limit * e.Start);
                    this.Store1.DataBind();
                }
                else
                {
                    this.Store1.SetDataFromJson("[]");
                }
            }

    response with noresult
    {serviceResponse:{Data:{data:[], totalCount: 0},Success:true}}

Similar Threads

  1. Replies: 3
    Last Post: Feb 21, 2012, 10:49 AM
  2. Replies: 1
    Last Post: Dec 22, 2011, 6:17 AM
  3. [CLOSED] Store: Is it possible to QueryBy a store with another store?
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 03, 2011, 9:38 AM
  4. [CLOSED] Access Grid Data Store and manually store to database
    By macap in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 05, 2011, 8:52 AM
  5. Replies: 1
    Last Post: Nov 01, 2010, 9:00 PM

Posting Permissions