[CLOSED] Grid Error Handling

  1. #1

    [CLOSED] Grid Error Handling

    When using your Grid with MVC, do you have any good examples of / best practices for error handling?
    Last edited by Daniil; Jun 14, 2012 at 8:53 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Unfortunately, we have no such example at the moment.

    Though it should not be difficult.

    To handle errors you need:

    1. Set up
    MessageProperty="message"
    for the Store Reader.

    2. Use the StoreResult Success and Message properties.

    3. Handle the Exception event of Store or its Proxy.

    For example, getting an error message (which you set up for a StoreResult) within the Proxy Exception listener would look like this:
    <ext:AjaxProxy>
        <Listeners>
            <Exception Handler="alert(operation.getError());" />
        </Listeners>
    </ext:AjaxProxy>
    See also
    http://docs.sencha.com/ext-js/4-1/#!...vent-exception
  3. #3
    Ok. I thought that was simple enough, but apparently not. When I have this combination:


    Proxy:
     .Proxy(Sub(proxy)
                                                                                 Dim prxy As New Ext.Net.AjaxProxy()
                                                                                 With prxy
                                                                                     .API.Create = Url.Content("~/Assignments/_AddTeam/")
                                                                                     .API.Read = Url.Content("~/Assignments/_GetTeams/") + MvcApplication.CurrentApplicationUser.EmployeeID.ToString()
                                                                                     .API.Update = Url.Content("~/Assignments/_EditTeam")
                                                                                     .API.Destroy = ""
                                                                                     .Json = True
                                                                                     .Reader.Add(New Ext.Net.JsonReader() With {.Root = "Data", .AutoDataBind = True})
                                                                                 End With
                                                                                         
                                                                                 proxy.Add(prxy)
                                                                             End Sub) _

    With this code:
    <HttpPost()>
            Public Function _AddTeam(ByVal team As Models.CWTeam()) As Ext.Net.MVC.StoreResult
                Dim grid As New Ext.Net.MVC.StoreResult()
    
                If team IsNot Nothing Then
                    Dim results As New List(Of Models.CWTeam)
                    Dim svc As New Services.TeamService
    
                    For Each tm In team
                        Try
                            results.Add(svc.CreateTeam(tm))
                            grid.Data = results
                        Catch ex As SystemException
                            grid.Message = ex.Message
                        End Try
                    Next
    
                    Return grid
                Else
                    Return grid
                End If
            End Function
    It throws a build error. When setting up the grid for error handling, am I supposed to use some other construct than the Proxy in the Razor syntax?
    My code builds fine when returning a regular ActionResult from the Function that returns a view.
  4. #4
    Quote Originally Posted by adelaney View Post
    It throws a build error.
    Please always provide a bit more details about errors. So, please clarify what exactly error?

    Quote Originally Posted by adelaney View Post
    When setting up the grid for error handling, am I supposed to use some other construct than the Proxy in the Razor syntax?
    Well, everything should look the same in Razor in that aspect.

Similar Threads

  1. [CLOSED] Javascript Global Error Handling
    By adelaney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 20, 2012, 8:30 PM
  2. Global Error Handling
    By wdk in forum 1.x Help
    Replies: 2
    Last Post: Apr 03, 2012, 2:34 AM
  3. [CLOSED] [8.2] PageTreeLoader - error handling in OnNodeLoad
    By mrozik in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 13, 2010, 7:40 PM
  4. [CLOSED] [1.0] Global error handling of DirectMethods
    By jchau in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 27, 2010, 7:59 PM
  5. [CLOSED] Error handling in GridPanel/Store AjaxEvents
    By jchau in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 09, 2009, 5:49 PM

Tags for this Thread

Posting Permissions