[CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    Title of Post: trying to make example similar to ObjectDataSourceServerPaginogrting.aspx in SandBox (title got swallowed)

    I'm trying to take this example and make it work against my own simple objectdatasource. I've copied you aspx file into my own project (copied the most recent three coolite dll's) and simply changed the column names to get from the store and show in the grid. (as well as created the same method signature for retrieving records from my ODS as yours).

    In VS, I can see my Get method in the ODS being called, I can see it returning three records, I see those three records get serialized as JSON objects, but my resulting page has the grid with my titles, but no data appears. when I press refresh in the bottom right, the Get method gets called again, it gets 3 records, but things go blank again.

    As I'm mostly now on a hunt to better understand Coolite and ExtJS, my question is two parts. First, what happened? OK, not a very good question. My second question is how can I debug the with vs2008 the javascript emitted from coolite? I'd like to set a break point and step through it to actually see the JSON data coming down the pipe.

    Thanks again for such an awesome product. You guys are great!

    (I'm attaching my code below, though I'm more interested in how to debug it myself)
  2. #2

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    Hi Peter,

    First, please update from the SVN (the bug was fixed the other day, i think if you set a LoadException listener with old source code then you can see error)

    About javascript debug,

    1.Please ensure that javascript debug enabled in IE (the debug disabled by default) (Tools - > Internet Options -> Advanced -> Settings tree -> )
    uncheck Browsing -> Disable script debugging (Internet Explorer)
    uncheck Browsing -> Disable script debugging (Other) (not required)
    check Browsing -> Display a notification about every script error

    2. Run a page under Visual Studio debug
    3. In Solution Explorer you can see Script Documents, you can open any script document and set breakpoint (http://weblogs.asp.net/scottgu/archi...debugging.aspx)

    P.S. You can use 'debugger' word in source js code (under debug the VS will intercept a control when the debugger word run in browser)

  3. #3

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx



    RE: the script debugging...

    I would also highly recommend installing and getting to know the FireBug plugin for FireFox.
    Geoffrey McGill
    Founder
  4. #4

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    thanks, I do have debugging enabled in IE and have been using it for a while. the problem I find is that the ExtJS gets loaded dynamically so I can't figure out how to set a debug point at the beginning of the script to step through it. Also, it generates on one line, so when I do get stopped by VS, I can't really read the code or set a break point.

    So, I did add the loadException you suggested in my <ext:store> and am now seeing the error. I'm not sure what to make of it, or how to go about fixing it. I'm attaching the screen shot of the debug and the text. In firefox, the debug alert loads across all three of my screens and then freezes so all I can do is exit. at least right mouse/select all/copy works.

    Also, in firebug, I can't set a break point also because of the one line javascript. Thoughts on that?

    Thanks again for the help.

    (I updated 20 minutes ago to latest source)
  5. #5

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    Hi Peter,

    Your code works fine for me, just add some code (AutoLoadParams and set a Selected handler for ObjectDataSource, remove unnecessary code )

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFormODSTest.aspx.cs"
        Inherits="ThreePe.WebFormODSTest" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Coolite Toolkit - GridPanel with ObjectDataSource</title>
    
        <script runat="server">
            protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
                ObjectDataSource1.SelectParameters["start"].DefaultValue = e.Start.ToString();
                ObjectDataSource1.SelectParameters["limit"].DefaultValue = e.Limit.ToString();
                ObjectDataSource1.SelectParameters["sort"].DefaultValue = e.Sort;
                ObjectDataSource1.SelectParameters["dir"].DefaultValue = e.Dir.ToString();
    
                Store1.DataBind();
            }
    
            protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e)
            {
                (this.Store1.Proxy[0] as DataSourceProxy).TotalCount = (int)e.OutputParameters["count"];
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        
            <ext:ScriptManager ID="ScriptManager1" runat="server" CleanResourceUrl="false" ScriptMode="Debug" />
            
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OnSelected="ObjectDataSource1_Selected"
                SelectMethod="GetMembersFilter" TypeName="BusinessObject">
                <SelectParameters>
                    <asp:Parameter Name="start" DefaultValue="0" Type="Int32" />
                    <asp:Parameter Name="limit" DefaultValue="3" Type="Int32" />
                    <asp:Parameter Name="sort" DefaultValue="" />
                    <asp:Parameter Name="dir" DefaultValue="" />
                    <asp:Parameter Name="count" DefaultValue="" Direction="Output" Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
            
            <ext:Store ID="Store1" runat="server" DataSourceID="ObjectDataSource1" AutoLoad="true"
                RemoteSort="true" OnRefreshData="Store1_RefreshData">
                <AutoLoadParams>
                    <ext:Parameter Name="start" Value="={0}" />
                    <ext:Parameter Name="limit" Value="={3}" />
                </AutoLoadParams>
                <Proxy>
                    <ext:DataSourceProxy />
                </Proxy>
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="Name" />
                            <ext:RecordField Name="Email" />
                            <ext:RecordField Name="LastName" />
                            <ext:RecordField Name="CreateDate" Type="Date" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
            
            <ext:GridPanel runat="server" ID="GridPanel1" Width="1000" Height="570" Title="Employees"
                Frame="true" StoreID="Store1">
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column ColumnID="Name" Header="Name" DataIndex="Name" Width="150">
                        </ext:Column>
                        <ext:Column DataIndex="Email" Header="Email" Width="150" />
                        <ext:Column DataIndex="CreateDate" Header="Create Date" Width="110">
                            <Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel runat="server" />
                </SelectionModel>
                <BottomBar>
                    <ext:PagingToolBar ID="PagingToolBar1" runat="server" PageSize="3" StoreID="Store1"
                        DisplayInfo="true" DisplayMsg="Displaying employees {0} - {1} of {2}" EmptyMsg="No employees to display" />
                </BottomBar>
                <LoadMask ShowMask="true" />
            </ext:GridPanel>
            
        
    
        </form>
    </body>
    </html>
    If it doesn't work for you then can debug code for search bug.

    1. Run this page under the VS Studio debug
    2. After the page loading to a browser please switch to the VS IDE
    3. In top of the Solution Explorer you should see 'Script Documents'
    4. The Script Documents contains many nodes. We need one of the node starts with WebResource (such nodes several)
    5. Please find script document contains code of DataSourceProxy (this file starts with HttpWriteProxy class and DataSourceProxy starts in line 1014)
    6. Set breakpoints to successHandler and errorHandler handlers
    7. Switch to the browser and press the Refresh button on the PagingToolbar
    8. The VS Studio must intercept control when a response from a server come back to the browser
    9. Debug code by step while you can find a reason of load exception (if control to get errorHandler then need to see what error in request)

    Please let me know about results


  6. #6

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    Thanks Vladsch,

    It's still not working for me but now I understand how to debug scripts included. I'm still fuzzy on how to debug the script that is all one line that is included with the aspx page.

    I added the autoloadparameters as you show, but am not sure what you mean by selected event of objectdatasource. Are you talking about this? It seems already there.
     protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e)
            {
                (this.Store1.Proxy[0] as DataSourceProxy).TotalCount = (int)e.OutputParameters["count"];
            }
    Also, I still get the error, but did set the debugger as you suggest and it's reporting a syntax error. I'm attaching three pictures of the debugger watch that hopefully will help point me at the error.

    Thanks again.

  7. #7

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    It seems that in web.config missing CooliteAjaxRequestModule

    please see http://forums.ext.net/showthread.php...1360-16-1.aspx

    P.S. re:ObjectDataSource1_Selected. Yes, handler was exists in code but was missing OnSelected="ObjectDataSource1_Selected"

    in ObjectDataSource markup


  8. #8

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    Thank you Vladsch!

    Total victory. Once I added the module it worked perfectly. I'm thinking had a dragged the control onto the page, it would have probably added the module automagically but I probably did not build it that way (old habits, I still type things sometimes).

    BTW, great design for how you transfer data back and forth using ObjectDataSource and JSON. I still don't get quite how it all works yet, but it's clear it's very clever and efficient. it's nice not to have to declare handler's all over the place.

    Take Care, and thanks again for sticking with me through the problem.
  9. #9

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx



    I'm not sure if it was mentioned above, but there are a couple properties on the <ext:ScriptManager> that might help when debugging.

    Example
    <ext:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug" SourceFormatting="true" />
    The ScriptMode="Debug" property will output the -debug versions of the .js files. The -debug version have all the original line-breaks and tabs.

    The SourceFormatting="true" property adds a bit of formatting (line breaks, tabs) to the config script. The formatting is not great right now and we have a much better solution in the works, but it should help 'expand' things so it's not all in one line.

    Hope this helps.
    Geoffrey McGill
    Founder
  10. #10

    RE: [CLOSED] question on sandbox/ObjectDataSourceServerPagingorting.aspx

    Hi Peter,

    Were all your questions answered for this topic? Just wanting to tie this one off if you're satisfied.*


    Geoffrey McGill
    Founder
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Help with MergeTest - example from Sandbox
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Sep 28, 2010, 6:41 PM
  2. Sandbox Example Error
    By fabiomarcos in forum 1.x Help
    Replies: 3
    Last Post: May 26, 2009, 8:23 AM
  3. AjaxEvent from a child.aspx to a parent.aspx
    By egodoy in forum 1.x Help
    Replies: 2
    Last Post: Mar 23, 2009, 12:52 PM
  4. SandBox
    By Rod in forum 1.x Help
    Replies: 2
    Last Post: Sep 30, 2008, 5:56 AM
  5. Sandbox examples
    By robsworld2006 in forum Open Discussions
    Replies: 4
    Last Post: Jul 28, 2008, 4:01 PM

Posting Permissions