Results 1 to 3 of 3

Thread: Ext.Data.JsonStore passing complex objects

  1. #1

    Default Ext.Data.JsonStore passing complex objects

    Hi so I'm using ExtJs and MVC, specifically a for a data grid which calls a controller action to return the data for the grid.

    So I have the store I set the url to the action's url, this calls the action fine with start and limit set.

    The tricky part is I want to pass a complex object to the the action with the query parameters for the search.

    The object comes from the view's strongly typed data model, this is not a probelm I use it in the view to construct the baseParams.

    The problem is that it arrives at the controller as a String = "[object Object]" instead of an object with all the relevant properties.

    My data store looks like this:

    Ext.onReady(function() {
    var ds = new{url: '/crm/Customer/SearchAccounts'
    ,root: 'Rows'
    ,totalProperty: 'RowCount'
    ,idProperty: 'Id'
    ,fields: [{name: 'Id'
    {name: 'AccountNumber'
    {name: 'AccountName'
    {name: 'Contacts'
    ,baseParams: {
    crit : {
    ,CustomerId : 'Model.CustomerId'
    ,UserName : 'Model.UserName'
    ,Surname : 'Model.Surname'
    ,PhoneNumber : 'Model.PhoneNumber'
    ,Firstname : 'Model.Firstname'

    ds.load({ params: { start: 0, limit: 15} });

    The controller action looks like this:

    public JsonResult SearchAccounts(CustomerSearchCriteria crit, int start, int limit)

    in this form crit is null.

    When I try like this:

    public JsonResult SearchAccounts(String crit, int start, int limit)

    crit = "[object Object]"

    When I try like this

    public JsonResult SearchAccounts(Object crit, int start, int limit)

    crit = { string[1] = "[object Object]"}

    What am I doing wrong?!?! am I just missing the point here or what?

    I think I might be building or passing the object wrong.

    Any help much appreciated.

  2. #2
    Sencha User's Avatar
    Join Date
    Mar 2007
    DC Area =)


    try :
    var baseParams = Ext.encode({
    crit : {
    ,CustomerId : 'Model.CustomerId'
    ,UserName : 'Model.UserName'
    ,Surname : 'Model.Surname'
    ,PhoneNumber : 'Model.PhoneNumber'
    ,Firstname : 'Model.Firstname'
    then baseParams : baseParams

  3. #3


    After more research something like that may have worked with a custom model binder... instead i used this:
    basparams: {
    crit.CustomerId : 'Model.CustomerId',
    crit.UserName : 'Model.UserName',
    crit.Surname : 'Model.Surname',
    crit.PhoneNumber : 'Model.PhoneNumber',
    crit.Firstname : 'Model.Firstname',

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts