[CLOSED] MVC Grid Batch Editing

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] MVC Grid Batch Editing

    I have a grid in an MVC application where I want to perform batch updates on a button click. The grid has the cell editing plugin in place. I have set up the button to connect to a DirectMethod, but I don't know how to pass any "bulk" parameters. In the example here: https://examples2.ext.net/#/GridPanel/Update/Batch/ the event sends back the sender and the event args, but I don't think that is really relevant to MVC. However, if it is, I don't know to configure the Params object of the button to provide those values. Can you please point me in the right direction?

    Thanks in advance.
    Last edited by geoffrey.mcgill; Sep 29, 2012 at 2:08 AM. Reason: [CLOSED]
  2. #2
    Hi @adelaney,

    You should pass this
    #{Store1}.getChangedData({skipIdForNewRecords : false})
    as a parameter of a DirectMethod request.

    Configure the controller action with
    string data
    parameter and use this parameter directly instead of e.ExtraParams["data"].
    ChangeRecords<TestPerson> persons = new StoreDataHandler(data).BatchObjectData<TestPerson>();
  3. #3
    I am so sorry. I forgot to mention that this is a treeGrid and not a "normal" grid. I tried the solution above, but it errored on "parameter mismatch." I have to assume that a TreeGrid does support this "changed data" in this way. :(
  4. #4
    Yes, TreeStore doesn't support the getChangedData method. We will consider a possibility to get it working.
  5. #5
    Um. Ok. However, I am not asking you to implement new functionality. You can if you would like. That seems nice, considering it is a grid. However, what I am asking is HOW, using your UI tool, do I solve this need. Are you telling me that there is no way to batch edit a TreeGrid? Am I not able to simply pass the entire Tree data and check a "dirty" property or something? If there is no way to batch edit, is there a way to mimick it via some client calls (i.e. looping through the tree and calling a single edit for every line)?
  6. #6
    Yes, you are right, iterating the nodes and using its isDirty and getChanges methods can help to get a changed data.
  7. #7
    Great! I can do that. So, back to the original question. How do I set up my view to send my data back to the controller? I tried this:
    .Buttons(Html.X.Button.Text("Save Changes").Icon(Icon.Accept).Handler("#{DirectMethods}.SaveChanges()") _
                       .Params(Sub(params)
                                 params.Add("#{storeReinsurerTree}.root.data")
                               End Sub
                       )) _
    But that throws an error of "parameter count mismatch."
  8. #8
    Please use the Ext.net.DirectMethod.request method. Here is an example.
    https://examples2.ext.net/#/Events/D...ds/WebService/
  9. #9
    An unfortunate issue I did not see coming would be some trouble with the length of JSON rendered from the tree. As a result, I have been trying a few things. One thing that seems to have some potential is using the Proxy to update and sync the store. I have been able to get the data to post to the controller and only the changed rows are posting - that's really helpful. However, there is one oddity: no date values are making it to the controller. They are all showing "null" ("#12:00:00 AM#"), but all the other data is mapping correctly. Is there something specific I need to configure on the TreeGrid model or ColumnModel columns in order to get the date fields to map through?


    As an aside, I do see the data in the post:
    [{"Name":"SAMPLE","ParentCode":"0X0","DateSentToRI":"2012-09-28CDT00:00:00","DateSignedDocSentToRI":"","ReinsurerCode":"1QO","TrackDates":true,"DateReceivedFromRI":"","NeverSigning":false,"ReinsurerContactName":"","ReinsurerContactID":"","id":null,"parentId":null,"leaf":true},{"Name":"SAMPLE":"0X0","DateSentToRI":"2012-09-28CDT00:00:00","DateSignedDocSentToRI":"","ReinsurerCode":"1QO","TrackDates":true,"DateReceivedFromRI":"","NeverSigning":false,"ReinsurerContactName":"","ReinsurerContactID":"","id":null,"parentId":null,"leaf":true}]
    Class Sample:
    Public Property DateSentToRI() As Date
                Get
                    Return _dateSentToRI
                End Get
                Set(ByVal value As Date)
                    _dateSentToRI = value
                End Set
            End Property
    
    
            Public Property DateReceivedFromRI() As Date
                Get
                    Return _dateReceivedFromRI
                End Get
                Set(ByVal value As Date)
                    _dateReceivedFromRI = value
                End Set
            End Property
    
            Public Property DateSignedDocSentToRI() As Date
                Get
                    Return _dateSignedDocSentToRI
                End Get
                Set(ByVal value As Date)
                    _dateSignedDocSentToRI = value
                End Set
            End Property
  10. #10
    Quote Originally Posted by adelaney View Post
    As an aside, I do see the data in the post:
    [{"Name":"SAMPLE","ParentCode":"0X0","DateSentToRI":"2012-09-28CDT00:00:00","DateSignedDocSentToRI":"","ReinsurerCode":"1QO","TrackDates":true,"DateReceivedFromRI":"","NeverSigning":false,"ReinsurerContactName":"","ReinsurerContactID":"","id":null,"parentId":null,"leaf":true},{"Name":"SAMPLE":"0X0","DateSentToRI":"2012-09-28CDT00:00:00","DateSignedDocSentToRI":"","ReinsurerCode":"1QO","TrackDates":true,"DateReceivedFromRI":"","NeverSigning":false,"ReinsurerContactName":"","ReinsurerContactID":"","id":null,"parentId":null,"leaf":true}]
    Is it a load or save request?

    As far as I can understand it is a load request.

    The default DateFormat of ModelField with Type="Date" is "yyyy-MM-ddTHH:mm:ss". So, please try to set your format.

    Example
    <ext:ModelField Name="date" Type="Date" DateFormat=""yyyy-MM-ddCDTHH:mm:ss"">
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Grid Panel - Conditional Editing
    By adelaney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 17, 2012, 6:03 AM
  2. [CLOSED] MVC Grid Editing
    By adelaney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 23, 2012, 9:49 AM
  3. Replies: 2
    Last Post: Jun 16, 2011, 6:50 AM
  4. [CLOSED] Grid panel Editing?
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 01, 2009, 8:22 AM
  5. Inline Editing in a Grid using combobox
    By gido in forum 1.x Help
    Replies: 3
    Last Post: Sep 11, 2009, 6:55 AM

Tags for this Thread

Posting Permissions