[CLOSED] After doing a 'Store1.DataBind()' how could I find the count of how many items are in the Store ???

  1. #1

    [CLOSED] After doing a 'Store1.DataBind()' how could I find the count of how many items are in the Store ???

    The syntax has change from the last version I was using which was v1.4

    Or even finding out the items in the Grid that Store1 is binded too ??
    Last edited by Daniil; Jul 25, 2012 at 12:55 AM. Reason: [CLOSED]
  2. #2
    Hi,

    The syntax has change from the last version I was using which was v1.4
    Please provide more details.

    Or even finding out the items in the Grid that Store1 is binded too ??
    It would be best to call the GetCount or Length of the object which you apply to the Store DataSource.
  3. #3
    Thats the issue, when I call the Store1.DataBind(), it calls a Handler which I setup in the Page Load like this:

                       Store1.Proxy.Add(new AjaxProxy
                        {
                            NoCache = true,
                            Json = true,
                            ActionMethods = { Read = HttpMethod.GET },
                            Reader = { new JsonReader { Root = "Data", TotalProperty = "TotalRecords" } },
                            Url = Core.Web.ProcessController.GetHandlerUrl()
                        });
    and my handler then return this:
            context.Response.Write(JSON.Serialize(list));
    So I don't have an object to that DataSource.

    Quote Originally Posted by Daniil View Post
    Hi,



    Please provide more details.



    It would be best to call the GetCount or Length of the object which you apply to the Store DataSource.
  4. #4
    If the Store is configured with the Proxy please call
    store.LoadProxy();
    to initiate a load request.

    And there is no way to get the count of loaded records just after the LoadProxy calling, because they are loaded asynchronously via AJAX since you have set up the AjaxProxy.

    You could get the count of records client side setting up a callback.

    Example
    JFunction fn = new JFunction()
    {
        Handler = "alert(records.length);",
        Args = new string[] { "records", "operation", "success" }
    };
    Store store = this.GridPanel1.GetStore();
    store.LoadProxy(new
    {
        callback = fn
    });
  5. #5
    Ok, let me give it a shot, I have never implemented a callback function before...

    Leave this tread open, I'll get back to you.

    Thanks for pointing me in the right direction.

    Quote Originally Posted by Daniil View Post
    If the Store is configured with the Proxy please call
    store.LoadProxy();
    to initiate a load request.

    And there is no way to get the count of loaded records just after the LoadProxy calling, because they are loaded asynchronously via AJAX since you have set up the AjaxProxy.

    You could get the count of records client side setting up a callback.

    Example
    JFunction fn = new JFunction()
    {
        Handler = "alert(records.length);",
        Args = new string[] { "records", "operation", "success" }
    };
    Store store = this.GridPanel1.GetStore();
    store.LoadProxy(new
    {
        callback = fn
    });
  6. #6
    I marked the thread as closed.

    Though please feel free to post any new related info.
  7. #7
    Should I open a NEW thread with related info. or just post here ???

    Quote Originally Posted by Daniil View Post
    I marked the thread as closed.

    Though please feel free to post any new related info.
  8. #8
    If it is tightly related to the current thread, please post here.

    If it is another issue, please start a new thread.

Similar Threads

  1. Replies: 1
    Last Post: Mar 29, 2012, 9:18 PM
  2. Replies: 1
    Last Post: Dec 12, 2011, 5:14 PM
  3. Replies: 0
    Last Post: Oct 25, 2011, 10:02 AM
  4. [CLOSED] [1.0] Tabstrip with dynamicly created items - items.count always 0
    By klaus.schwarz in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 07, 2010, 11:40 AM
  5. Count items in a ComboBox?
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 18, 2009, 11:25 AM

Tags for this Thread

Posting Permissions