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

[Solved] Batch editing with edit templates - problem.

6 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcin
Top achievements
Rank 1
Marcin asked on 12 Sep 2011, 01:57 PM

Hi,

/The code that I'm writing about is included in attachment/

I have problem with batch editing in grid using edit templates with combobox.

When I update both ProductName and IssueNumber and click Save changes, in method Save in HomeController my updated line object has new ProductName, but IssueNumber has still old value. If I insert new row or update only one property everything is ok.

Details are in project. 

Thanks in advance for any hints. 
Best regards,
Marcin

6 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 12 Sep 2011, 04:31 PM
Hello Marcin,

All you need is to modify e.values. For your convenience I am attaching the modified version of your code.

Greetings,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marcin
Top achievements
Rank 1
answered on 13 Sep 2011, 08:12 AM
Hi,

Thanks, your advice was helpful.

I have another problem yet:
when I update IssueNumber I want to update value of IssueDate too.

I do it in way you wrote:

e.values = $.extend(e.values, { IssueId: id, IssueNumber: number, IssueDate: date });

but the value in cell is not changing (not changing on the page - in view, in update method the value is correct).
Is there any way to refresh value of this cell in grid?

TIA.
Best regards,
Marcin
0
Nikolay Rusev
Telerik team
answered on 13 Sep 2011, 02:11 PM
Hello Marcin,

I am afraid that the data in the grid will not be updated except the currently edited cell. You will have to manually change the value for the other cells if this is your requirement.

Greetings,
Rusev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Marcin
Top achievements
Rank 1
answered on 14 Sep 2011, 09:50 AM
Hi,

Thanks for your reply. I'm not sure if I understand you correctly.
By "manually" do you mean to change the text value of <td> node? or there's an API to do it "safe way".
I'd be thankful for information.

Best regards,
Marcin
0
Accepted
Nikolay Rusev
Telerik team
answered on 15 Sep 2011, 12:12 PM
Hello Marcin,

I am afraid that there is no "safe way" for this case.You can use the following code for example:
if (e.values.IssueNumberComboBox) {
...
            e.values = $.extend(e.values, { IssueId: id, IssueNumber: number, IssueDate: date });       
            $(e.cell).next().html(date);        
        }
        else if (e.values.ProductNameComboBox) {
...
}


Best wishes,
Rusev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Marcin
Top achievements
Rank 1
answered on 15 Sep 2011, 02:40 PM
Hi,

Thanks for your reply. I've just considered case when the user may reorder columns etc, so I thought that there's a setter for cells which is indexed i.e. by column name. But that's not a big problem I may try to write one by myself. I've just wanted to avoid writing an existing feature.

Best regards,
Marcin

Tags
Grid
Asked by
Marcin
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Marcin
Top achievements
Rank 1
Share this question
or