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

[Solved] Default edit mode on a Grid

7 Answers 156 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.
Beethoven124
Top achievements
Rank 1
Beethoven124 asked on 26 May 2010, 06:25 PM
Hi,

I have a grid with ajax databinding and my question is whether is it possible to set the edit mode by default on the grid? So I will load the page to see my grid in edit mode.

Dear Beethoven

7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 May 2010, 06:48 AM
Hi Beethoven124,

It is possible by using the grid client-side API. You can call the editRow JavaScript method of the grid. This can be done by handling the initial ondatabound event
<script type="text/javascript">
function ondatabound(){
    setTimeout(function() {
        var grid = $('#Grid').data('tGrid');
        grid.editRow($('#Grid tr:has(td):eq(0)'));
    }, 0);
}
</script>

Regards,
Atanas Korchev
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
Beethoven124
Top achievements
Rank 1
answered on 28 May 2010, 06:52 PM
Hi,

i tried it but i get an error in firebug for firefox "data is undefined". What´s going wrong?

Beethoven
0
Georgi Krustev
Telerik team
answered on 28 May 2010, 07:05 PM
Hello Beethoven124,

Did you search for correct grid? In $('#Grid') you need to replace "#Grid" with the id of your grid. For instance if the grid ID is "TestGrid", the code should look like so $('#TestGrid'). If the problem still persists, you can try to debug the code and see if the $('#Grid_ID') actually returns something.

Regards,
Georgi Krustev
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
Beethoven124
Top achievements
Rank 1
answered on 28 May 2010, 07:38 PM

Hi,

I will try it, but #Grid is the name of my Grid like Html.Telerik().Grid<NerdDinner.Models.DinnerFormViewModel>().Name("Grid")....
The <NerdDinner.Models.DinnerFormViewModel> is corrent. I see my Grid with all the data. Unfortunately, I can only test on monday. And I will debug my code.
Thx for your help.

Beethoven

 

0
H
Top achievements
Rank 1
answered on 26 Aug 2010, 02:27 PM
I'd like to use this to default to Edit mode too - but I can't figure out where I place the script. Where do I place the script to get it to execute?  

We are not using Ajax, does that make a difference?

Thanks.
0
Emmanuel
Top achievements
Rank 1
answered on 01 Sep 2010, 08:09 PM
I am getting the same issue

Error message in Firebug: "data is undefined"

I am pointing at the right Id and the Id does exist.

(Why does the code have to be in a Timeout method?)

Also, is it possible to have more than one row in Edit mode at the same time?

0
Donna Stewart
Top achievements
Rank 1
answered on 28 Jan 2011, 09:34 PM
Did anyone ever get this to work?

Thanks!
Donna
Tags
Grid
Asked by
Beethoven124
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Beethoven124
Top achievements
Rank 1
Georgi Krustev
Telerik team
H
Top achievements
Rank 1
Emmanuel
Top achievements
Rank 1
Donna Stewart
Top achievements
Rank 1
Share this question
or