[CLOSED] GridPanel Batch Update does not send data

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] GridPanel Batch Update does not send data

    I am using Ext.NET 2.1.1.18233 with Visual Studio 2010 and ASP.NET MVC 4. I am attempting to submit batch changes from a grid panel using a simple button. I have tried various examples and cannot get the grid panel to submit changed records to an MVC controller method. The POST data indicates that an empty JSON object is submitted. The relevant code samples including my model and grid panel are shown below. I have used the following example, and a forum thread for guidance:

    http://mvc.ext.net/#/GridPanel_Update/Batch/

    Much code is omitted for brevity. The grid panel view is complete.

    I have ensured that each model instance passed to the view has a unique ID. The GridPanel is populating with the correct records. I can edit the records using the row editing plugin without a problem. The problem is that when I click a save button, the page submits a request to the server, but the request has an empty encoded JSON object for the data parameter. Nothing is passed to the server that can be parsed or interpreted to determine the number and content of changed, updated, or deleted record(s).

    Model

        [Model(Name="ProfileStepModel", ClientIdProperty="PhantomId")]
        [JsonWriter(Encode=true, Root="data")]
        public class StationProfileStepModel
        {
            
            [ModelField(IDProperty = true, UseNull=true)]
            [Field(Ignore=true)]
            public int? ID { get; set; }
    
            [ModelField(Ignore=true)]
            public string PhantomId { get; set; }
    
            public string Type { get; set; }
    
            public int Time { get; set; }
    
            public int Channel1PID { get; set; }
    
            public int Channel2PID { get; set; }
    
            public double Channel1SetPoint { get; set; }
    
            public double Channel2SetPoint { get; set; }
    
            public bool Channel1GuaranteedSoak { get; set; }
    
            public bool Channel2GuaranteedSoak { get; set; }
    
            public int LoopFrom { get; set; }
    
            public int LoopTo { get; set; }
    
            public int LoopRepeatCount { get; set; }
    
        }
    Controller
    NOTE: The controller method is called; however, handler indicates there are no updated, changed, or deleted records.
            [HttpPost]
            public ActionResult Steps(int? profileId, StoreDataHandler handler)
            {
                if (handler.IsBatch)
                {
                    ChangeRecords<StationProfileStepModel> steps =
                        handler.BatchObjectData<StationProfileStepModel>();
                    var store = this.GetCmp<Store>("ProfileStepStore");
                }
           }
    View
    NOTE: I am passing a collection of model items in the view's controller function as a parameter to the View function
    @model IEnumerable<StationProfileStepModel>
    
    @(Html.X().GridPanel()
        .ID("ProfileEditorSteps")
        .Title("Profile Steps")
        .Height(500)
        .ColumnWidth(0.80)
        .TopBar(Html.X().Toolbar()
            .Items(
                                    
                Html.X().Button()
                    .Text("Insert Step")
                    .IconAlign(IconAlign.Top)
                    .Icon(Icon.ChartLineAdd),
                                                
                Html.X().Button()
                    .Text("Remove Step")
                    .IconAlign(IconAlign.Top)
                    .Icon(Icon.ChartLineDelete),
                                                
                Html.X().Button()
                    .Text("Clear Profile")
                    .IconAlign(IconAlign.Top)
                    .Icon(Icon.Bin)
                    .OnClientClick("Editor.onClearProfileSteps"),
                                            
                Html.X().Button()
                    .Text("Validate")
                    .IconAlign(IconAlign.Top)
                    .Icon(Icon.Tick)
                                        
            )
        )
        .Plugins(
            Html.X().RowEditing()
                .AutoCancel(false)
                .ClicksToMoveEditor(1)
                                       
        )
        .Store(Html.X().StoreForModel()
            .ID("ProfileStepStore")
        )
        .ColumnModel(
            
            Html.X().RowNumbererColumn()
                .Width(35),    
          
            Html.X().Column().Text("Type")
                .DataIndex("Type")
                .Editor(
                    Html.X().ComboBox()
                        .Items(
                            Html.X().ListItem().Text("Ramp/Soak"),
                            Html.X().ListItem().Text("Loop"),
                            Html.X().ListItem().Text("End")
                        )
                ),
                                            
            Html.X().Column().Text("Time")
                .DataIndex("Time")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(false)
                        .AllowDecimals(true)
                ),
                                            
            Html.X().Column().Text("CH 1 SP")
                .DataIndex("Channel1SetPoint")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(true)
                ),
                                            
            Html.X().Column().Text("CH 2 SP")
                .DataIndex("Channel2SetPoint")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(true)
                ),
                                            
            Html.X().CheckColumn().Text("CH 1 G. Soak")
                .DataIndex("Channel1GuaranteedSoak")
                .Editable(true),
                                            
            Html.X().CheckColumn().Text("CH 2 G. Soak")
                .DataIndex("Channel2GuaranteedSoak")
                .Editable(true),
                                            
            Html.X().Column().Text("CH 1. PID")
                .DataIndex("Channel1PID")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(false)
                ),
                                        
            Html.X().Column().Text("CH 2. PID")
                .DataIndex("Channel2PID")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(false)
                ),
                                        
            Html.X().Column().Text("Loop From")
                .DataIndex("LoopFrom")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(false)
                ),
                                        
            Html.X().Column().Text("Loop To")
                .DataIndex("LoopTo")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(false)
                ),
    
            Html.X().Column().Text("Repeat")
                .DataIndex("LoopRepeatCount")
                .Renderer("Editor.onRenderStep")
                .Editor(
                    Html.X().NumberField()
                        .AllowBlank(true)
                        .AllowDecimals(false)
                )
                                            
        )
    
    )
    Save Button
    Html.X().Button()
                        .IconAlign(IconAlign.Top)
                        .Icon(Icon.Disk)
                        .Text("Save")
                        .DirectEvents(e => {
                            e.Click.Url = Url.Action("Steps");
                            e.Click.ExtraParams.Add(new Parameter
                            {
                                Name = "data",
                                Mode = ParameterMode.Raw,
                                Encode = true,
                                Value = "Ext.getCmp('ProfileEditorSteps').store.getChangedData({skipIdForNewRecords: false})"
                            });  
                        })
    Last edited by Daniil; Jan 22, 2013 at 2:21 PM. Reason: [CLOSED]

Similar Threads

  1. Batch Update
    By shaileshsakaria in forum 2.x Help
    Replies: 1
    Last Post: Jan 18, 2013, 4:17 PM
  2. [2.1] GridPanelFor Batch Update
    By millenovanta in forum 2.x Help
    Replies: 20
    Last Post: Dec 26, 2012, 12:27 PM
  3. Replies: 2
    Last Post: Jun 16, 2011, 6:50 AM
  4. [CLOSED] Is there a way to send Store baseParams during Update
    By anup in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 14, 2011, 7:55 AM
  5. How to Update the GridPanel data to the DataSource
    By animalisme in forum 1.x Help
    Replies: 2
    Last Post: Jun 22, 2009, 3:09 AM

Tags for this Thread

Posting Permissions