Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default problem loading values to my extjs grid using json

    problem loading values to my extjs grid using json


    hello experts
    i am loading the values coming from database to my json object using java struts
    but the values are not populating in my extjs grid
    i am getting an empty grid
    this is my code

    <%@
    pagelanguage="java"contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>

    <!
    DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">

    <title>Insert title here</title>

    <linkrel="stylesheet"type="text/css"href="css/ext-all.css">
    <scripttype="text/javascript"src="js/ext-base.js"></script>

    <scripttype="text/javascript"src="js/ext-all.js"></script>
    <scripttype="text/javascript">

    Ext.onReady(
    function() {

    var store=new Ext.data.JsonStore({

    root:'employee',
    url:'getvalues.jsp',
    fields:['empid','empname']
    });
    store.load();
    var grid = new Ext.grid.GridPanel({
    title:'employee information',

    coloumns:[{header:"employeeid",width:100,dataIndex:'empid',sortable:true},

    {header:"employeename",width:100,dataIndex:'empname',sortable:true}
    ],
    store: store,
    renderTo:Ext.getBody(),
    width:300,
    height:300,
    loadMask:true,
    renderTo:Ext.getBody()
    });

    });

    </script>
    </head>
    <body>

    </body>
    </html>


    this is my java code

    Code:
    import java.util.ArrayList; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import net.*; import net.sf.json.JSONArray; import net.sf.json.JSONObject; public class Json extends Action { @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO Auto-generated method stub ArrayList<Employee> emp=new ArrayList<Employee>(); Myservice serve=new Myservice(); emp=serve.getemployeesservice(); Iterator<Employee> empitr=emp.iterator(); JSONArray json=new JSONArray(); JSONObject JSONobj=new JSONObject(); while(empitr.hasNext()){ JSONObject jobj=new JSONObject(); jobj.put("empid",empitr.next().getEmpid()); jobj.put("empname",empitr.next().getEmpname()); json.add(jobj); } JSONobj.put("employee",json); return mapping.findForward("success"); } }
    this is my struts config file

    <?xmlversion="1.0"encoding="UTF-8"?>

    <!DOCTYPEstruts-configPUBLIC

    "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"

    "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
    <struts-config>
    <action-mappings>
    <actionpath="/getvalues"type="Json">
    <forwardname="success"path="/getvalues.jsp"></forward>

    </action>

    </action-mappings>
    </struts-config>



    this is my complete coding
    when i run the program i am getting empty values
    please help me in solving this issue
    thanks in advance

  2. #2
    Sencha User siva565's Avatar
    Join Date
    Nov 2010
    Location
    India,Hyderabad
    Posts
    47
    Vote Rating
    0
    siva565 is on a distinguished road

      0  

    Default


    in your code duplicate renderTo existed. so remove one property. and check your store with proxy..this is the sample code

    var store = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
    url: 'folder_path/getvalues.jsp', //make sure this is the path where your file exist
    method: 'POST'
    }),
    reader: new Ext.data.JsonReader({
    root: 'results',
    id: 'Id'
    }, [
    'Id',
    'EmpNumber',
    'salary',
    'addtess',
    'contact',
    'email'

    ])
    });

    store.load();


    use firebug tool to see the database calls and responses...

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    Quote Originally Posted by siva565 View Post
    in your code duplicate renderTo existed. so remove one property. and check your store with proxy..this is the sample code

    var store = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
    url: 'folder_path/getvalues.jsp', //make sure this is the path where your file exist
    method: 'POST'
    }),
    reader: new Ext.data.JsonReader({
    root: 'results',
    id: 'Id'
    }, [
    'Id',
    'EmpNumber',
    'salary',
    'addtess',
    'contact',
    'email'

    ])
    });

    store.load();


    use firebug tool to see the database calls and responses...

    hello shiva
    i tried using like this
    even then i am getting empty grid

    <
    script type="text/javascript">

    Ext.onReady(function() {
    var store=new Ext.data.JsonStore({
    reader:new Ext.data.JsonReader({
    root:'employee',
    field:['empid','empname']
    }),
    proxy:new Ext.data.HttpProxy({
    url:'getvalues.do'

    })
    });
    store.load();
    var recs=store.getRange();
    alert(recs.length);
    var grid = new Ext.grid.GridPanel({
    title:'employee information',

    coloumns:[{header:"employeeid",width:100,dataIndex:'empid',sortable:true},
    {header:"employeename",width:100,dataIndex:'empname',sortable:true}
    ],
    storetore,
    width:300,
    height:300,
    renderTo:Ext.getBody()
    });



    });
    </script>

  4. #4
    Sencha User siva565's Avatar
    Join Date
    Nov 2010
    Location
    India,Hyderabad
    Posts
    47
    Vote Rating
    0
    siva565 is on a distinguished road

      0  

    Default


    install firebug addon for your firefox browser and let me know what it return in firbug

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    yup its not showing any errors
    i am very new to this extjs
    i could figure out this issue

  6. #6
    Sencha User siva565's Avatar
    Join Date
    Nov 2010
    Location
    India,Hyderabad
    Posts
    47
    Vote Rating
    0
    siva565 is on a distinguished road

      0  

    Default


    i think this will help you. http://examples.extjs.eu/

  7. #7
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    hello shiva i have checked the record length
    i am getting the rec length as zero

    var recs=store.getRange();
    alert(recs.length);

    can u tell me the possible reasons y the values are not getting populated so that i can study more and figure out this issue

  8. #8
    Sencha User siva565's Avatar
    Join Date
    Nov 2010
    Location
    India,Hyderabad
    Posts
    47
    Vote Rating
    0
    siva565 is on a distinguished road

      0  

    Default


    i think in proxy url:'' you need to give your file full path like (http://example.com/resources/getvalues.jsp).. did you check the output of getvalues.jsp file? is it working fine?

  9. #9
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    yes i have checked that url
    but i am not getting any values to my grid
    can u check my java code
    actually on form action i specified the url as getvalues.do
    and on performing neccessary actions in my servlet i am redirecting the page to getvalues.jsp
    i tried both the url s i am not getting values to my grid

  10. #10
    Sencha User
    Join Date
    Mar 2014
    Posts
    5
    Vote Rating
    0
    restr1c7ed is on a distinguished road

      0  

    Default


    I Have the same problem am using ext 4.1 the only difference is that am using php not jsp

Similar Threads

  1. Loading panel control values with available JSON
    By stratton in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 10 Jun 2009, 5:57 AM
  2. Problem in json loading in grid - help needed
    By kthiru72 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 25 Jan 2008, 4:41 AM
  3. Loading form values from json data
    By dlbjr in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 Dec 2007, 10:30 AM
  4. Having problem loading JSON data into grid
    By Blitz in forum Ext 1.x: Help & Discussion
    Replies: 8
    Last Post: 16 Aug 2007, 8:09 AM

Thread Participants: 2