[CLOSED] JSONP Proxy

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] JSONP Proxy

    What's the problem?
    I can't show data...


    this is my code

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>ScriptTag Proxy</title> 
    
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            Width="700" 
            Height="500" 
            DisableSelection="true" 
            Title="ExtJS.com - Browse Forums">
            <Store>
                <ext:Store ID="Store1" runat="server" RemoteSort="true" PageSize="50">
                    <Proxy>
                        <ext:JsonPProxy Url="http://pdo.gs.com.tw/oracle/oci_erp_gen_file.php" >
                            <Reader>
                                <ext:JsonReader Root="rows" TotalProperty="total" IDProperty="USER_ID" />
                            </Reader>
                        </ext:JsonPProxy>
                    </Proxy>
                    <Model>
                        <ext:Model ID="Model1" runat="server">
                            <Fields>
                                <ext:ModelField Name="FAC" />
                                <ext:ModelField Name="USER_ID" />
                                <ext:ModelField Name="USER_NAME" />
                                <ext:ModelField Name="PASSWORD" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column ID="Column1" runat="server" Text="FAC" DataIndex="FAC" Width="100" />
                    <ext:Column ID="Column3" runat="server" Text="USER_ID" DataIndex="USER_ID" Width="100" />
                    <ext:Column ID="Column4" runat="server" Text="USER_NAME" DataIndex="USER_NAME" Width="100" />
                     <ext:Column ID="Column2" runat="server" Text="PASSWORD" DataIndex="PASSWORD" Width="100" />
                </Columns>
            </ColumnModel>  
           <BottomBar>
                    <ext:PagingToolbar ID="PagingToolbar1" runat="server">
                    <Items>
                    </Items>
                    <Plugins>
                        <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
                    </Plugins>
                </ext:PagingToolbar>
            </BottomBar>     
        </ext:GridPanel>
        
    </body>
    </html>
    Last edited by Daniil; Apr 23, 2013 at 3:56 AM. Reason: [CLOSED]
  2. #2
    Hi @gs_user,

    Please wrap the code in code tags, see #3 here:
    More Information Required
  3. #3
    I don't think that 'http://wisys.twbbs.org/oracle/oci_xe_emp_users.php' supports JsonP because it ignores 'callback' parameter and doesn't wrap data in callback method

    Please see more about JsonP
    http://en.wikipedia.org/wiki/JSONP
  4. #4
    That's Right!
    I modify my php ignores callback
    It is work!

    another problem, PagingToolbar is not work,it's always load all data,How to let it's work?
    Is this my .php problem?


    Quote Originally Posted by Vladimir View Post
    I don't think that 'http://wisys.twbbs.org/oracle/oci_xe_emp_users.php' supports JsonP because it ignores 'callback' parameter and doesn't wrap data in callback method

    Please see more about JsonP
    http://en.wikipedia.org/wiki/JSONP
  5. #5
    Hello!

    Please, check that you return total count of objects.
  6. #6
    Hello!
    Can you help me?
    When i click next page, it's always load ALL data,How to let it's work?

    php code
    -----------------------------------------------------------------------
    header('content-type: application/json; charset=utf-8');
    
     $result["total"] = $rowcount;
       $result["rows"] = $items;
       echo $_GET['callback'] . '('.json_encode($result).')';
    ------------------------------------------------------------------------


    return result↓
    --------------------------------
    ({"total":"109","rows":[{"GEN01":null,"GEN02":"\u5353\u6842\u7389","GEN03":"AQ2","GEN04":"\u6280\u8853\u4f50"},{"GEN01":"iris","GEN02":"\u8463\u66c9\u8fb0","GEN03":"AQ4","GEN04":null},{"GEN01":"kitty","GEN02":"\u859b\u66c9\u96c1","GEN03":"AQ6","GEN04":null},{"GEN01":"minnie","GEN02":"\u9b4f\u654f\u73b2","GEN03":"AQ4","GEN04":null},{"GEN01":"b603","GEN02":"\u5a01\u5f17\u5fb7","GEN03":"AQ2","GEN04":null},{"GEN01":"annie","GEN02":"\u6eab\u6708\u798e","GEN03":"AQ2","GEN04":null},{"GEN01":null,"GEN02":"\u8a31\u80b2\u7504","GEN03":"AQ2","GEN04":"\u6280\u8853\u54e1"},{"GEN01":null,"GEN02":"\u5ed6\u96c5\u9234","GEN03":"AQ1","GEN04":"\u6280\u8853\u5e2b3\u7d1a"},{"GEN01":null,"GEN02":"\u7f85\u7f8e\u7434","GEN03":"AQ2","GEN04":"\u6280\u8853\u5e2b4\u7d1a"},{"GEN01":null,"GEN02":"\u5433\u745e\u9e9f","GEN03":"AQ1","GEN04":"\u5c08\u54e14\u7d1a"},{"GEN01":"connie","GEN02":"\u8b1d\u9cf3\u5100","GEN03":"AQ0","GEN04":null},{"GEN01":"lenia","GEN02":"\u8cf4\u79cb\u9999","GEN03":"AQ2","GEN04":null},{"GEN01":null,"GEN02":"\u7f85\u7d30\u83ca","GEN03":"AQ2","GEN04":null},.........]})


    Quote Originally Posted by Baidaly View Post
    Hello!

    Please, check that you return total count of objects.
    Last edited by Daniil; Apr 18, 2013 at 5:17 AM. Reason: Please use [CODE] tags
  7. #7
    I guess you need remote paging, but, I guess, you don't take into account paging parameters from a request, i.e. start, limit, page.

    Here:
    $result["rows"] = $items;
    Does "$items" contains all the items?

    The idea is to return data for a requested page only, not all the data.
  8. #8

    when i click next page, it is always load all data

    Hello!

    In this sample https://examples2.ext.net/#/GridPane...s/JSONP_Proxy/
    it can change page perfect!
    Could you please provide the sample of php source code to me?
    I want to know how to take into account paging parameters from a request?

    What the sample background database is?

    I'm use the database is "Oracle 10g".

    Is the DB difference?





    Quote Originally Posted by Daniil View Post
    I guess you need remote paging, but, I guess, you don't take into account paging parameters from a request, i.e. start, limit, page.

    Here:
    $result["rows"] = $items;
    Does "$items" contains all the items?

    The idea is to return data for a requested page only, not all the data.
  9. #9
    That is an external site we are accessing and do not have the server implementation.

    The server-side implementation of your JsonP feed is beyond the scope of support we can provide.
    Geoffrey McGill
    Founder
  10. #10
    Your Right!
    The idea is to return data for a requested page only, not all the data.

    I Solve this problem.
    This is my php code,Provide a reference~
    <?php
         // header("Access-Control-Allow-Origin: *");
    	 header('content-type: application/json; charset=utf-8');
    	 header("Access-Control-Allow-Origin: *");
    	 $start=$_GET['start']+1;
         $limit=$_GET['limit']*$_GET['page'];
         $result = array();
      
       
         $conn = oci_connect('test_owner', 'password', '192.168.xx.xx/test_db','AL32UTF8');
          $stid = oci_parse($conn, "SELECT gen01,gen02,gen03,gen04 FROM ( 
    	SELECT rownum rum,gen01,gen02,gen03,gen04  FROM gen_file )  where rum between ".$start." and ".$limit);
          oci_execute($stid);
               
    
           $items = array();  
    	while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
    		array_push($items, $row);  
    	}
    
       
           $rowcount = 0;
            $stid1 = oci_parse($conn, "SELECT count(*) as TOTAL  FROM gen_file  ");
            oci_define_by_name($stid1, 'TOTAL', $rowcount);
            oci_execute($stid1);
            oci_fetch($stid1);
         
       $result["total"] = $rowcount;
       $result["rows"] = $items;  
        oci_free_statement($stid);
        oci_free_statement($stid1);
        oci_close($conn);   
       echo $_GET['callback'] . '('.json_encode($result).')';
       
    
    	
    ?>
    Quote Originally Posted by Daniil View Post
    I guess you need remote paging, but, I guess, you don't take into account paging parameters from a request, i.e. start, limit, page.

    Here:
    $result["rows"] = $items;
    Does "$items" contains all the items?

    The idea is to return data for a requested page only, not all the data.
Page 1 of 2 12 LastLast

Similar Threads

  1. How to use Odata proxy
    By PetrSnobelt in forum 2.x Help
    Replies: 5
    Last Post: Mar 13, 2013, 6:12 AM
  2. Example of infinite scrolling without using proxy
    By yash.kapoor in forum 2.x Help
    Replies: 2
    Last Post: Jan 02, 2013, 7:12 AM
  3. JSONP and Webservices versus Generic Handlers
    By plykkegaard in forum 1.x Help
    Replies: 3
    Last Post: Feb 21, 2012, 12:41 PM
  4. What exactly is Page Proxy?
    By chearner in forum 1.x Help
    Replies: 5
    Last Post: Jan 09, 2012, 9:52 PM
  5. Proxy with Nested Url
    By Dominik in forum 1.x Help
    Replies: 3
    Last Post: Jun 10, 2010, 6:53 AM

Tags for this Thread

Posting Permissions