?
Solved

ExtJS, issues with trying to create a datastore

Posted on 2010-11-08
2
Medium Priority
?
723 Views
Last Modified: 2012-05-10
I have the following code and it's always failing. What is the best way to provide a detailed error message so I can see what the issue is?
function createDataStore(){

    var url = GLOBAL_URI + '/Users';
    myNamespace.UserDataStore = new Ext.data.JsonStore({
        url: url,
        root: 'Subscriptions',
        id: 'userId',
        fields: [{
            name: 'userId'
        }, {
            name: 'userName'
        }]
    });
    
    var objUser = {
        "userId": "",
        "Id": ""
    };
    
    
    myNamespace.UserDataStore.proxy.conn.jsonData = objUser;
    myNamespace.UserDataStore.proxy.conn.method = 'POST';
    
    myNamespace.UserDataStore.load({
        callback: function(records, o, s){
            if (!s) 
                Ext.MessageBox.show({
                    title: 'Error',
                    msg: 'POST method failed',
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.ERROR
                });
            else 
                Ext.getCmp('ddlUserId').setValue(userId);
        }
    });
}

Open in new window

0
Comment
Question by:PixelMuse
2 Comments
 

Author Comment

by:PixelMuse
ID: 34087961
I've debugged it using Fiddler and it is showing me a "HTTP/1.1 400 Bad Request" error.

Any thoughts on ways to solve that?
0
 
LVL 6

Accepted Solution

by:
youssefomar earned 2000 total points
ID: 34092109
I think the error is caused by not specifying the target server side script where the data is supposed to be POSTed

try to add something like this:

myNamespace.UserDataStore.proxy.conn.url = 'file_name.php'

before or after :

    myNamespace.UserDataStore.proxy.conn.jsonData = objUser;
    myNamespace.UserDataStore.proxy.conn.method = 'POST';

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question