This is a migrated thread and some comments may be shown as answers.

"Editor cannot be initialized for column" problem with batch mode

4 Answers 210 Views
Grid
This is a migrated thread and some comments may be shown as answers.
أشرف
Top achievements
Rank 1
أشرف asked on 06 Jan 2014, 02:15 PM
Greetings,

I have a setup in which I want to set the values of cells of a certain column programmatically. The column won't be displayed to the user, so I set Display=false

The grid is a batch mode grid, and I set the values before the user saves the data as follows:

grid.add_command(function (sender, args)
        {
            if(args.get_commandName() == "BatchEdit")
            {
                var tv = grid.get_masterTableView(),
                    bm = grid.get_batchEditingManager(),
                    dumpCellIndex = tableView.getColumnByUniqueName("Dump").get_element().cellIndex;
 
                tv.get_dataItems().forEach(function (di)
                {
                    var row = di.get_element();
 
                    if(row._data)
                        bm.changeCellValue(row.cells[dumpCellIndex], row._data.join(";"));
                });
            }
        });

On the server, I get the following error in the BatchEditCommand event handler when I try to access the Commands member of GridBatchEditingEventArgs: "Editor cannot be initialized for column: Dump"

I tried to set Display=true but still the problem happens. Dump is just a simple GridBoundColumn:

<telerik:GridBoundColumn Display="true" DataType="System.String" FilterControlAltText="Filter Dump column" UniqueName="Dump" ReadOnly="false" ForceExtractValue="None">
                            <ColumnValidationSettings>
                                <ModelErrorMessage Text="" />
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>

4 Answers, 1 is accepted

Sort by
0
Accepted
Angel Petrov
Telerik team
answered on 09 Jan 2014, 11:04 AM
Hi Ashraf,

I tried reproducing the described issue in an isolated sample but to no avail. Could you please examine the attached website and tell us what differs in your case?

Additionally I would suggest changing the cells value prior to clicking the SaveChanges button as the OnCommand event is fired too late for that purpose. Also I did not notice a DataField to be set for the column. That said could you please elaborate more on how are the cells populated?

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
أشرف
Top achievements
Rank 1
answered on 09 Jan 2014, 01:37 PM
It appears that GridBoundColumn must have the DataField property set, otherwise it will cause this problem.
I changed the column to a TemplateColumn and now the problem doesn't happen.

I have to write these data before the save operation. What event is suitable for this?
0
Angel Petrov
Telerik team
answered on 14 Jan 2014, 09:47 AM
Hi Ashraf,

Could you please elaborate more on the exact requirement? Can you tell us which rows should have a changed value before they are submitted?

Changing the values by subscribing to an event which is fired once the Save Changes button is clicked will not work because the grid will already have extracted the data from the HTML. Is there a reason which prevents you from using the OnBatchEditCommand server-side event for manipulating the data?

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
أشرف
Top achievements
Rank 1
answered on 14 Jan 2014, 01:10 PM
I've cancelled the idea of using a hidden column. I'll use a hidden input to store the values instead.

Thanks for your reply.
Tags
Grid
Asked by
أشرف
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
أشرف
Top achievements
Rank 1
Share this question
or