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

[Solved] How to keep the "add new" row always displayed?

3 Answers 145 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.
P-A
Top achievements
Rank 1
P-A asked on 07 Sep 2012, 08:15 AM
Hello,

i wonder how I could keep the "Add new" row always displayed on the grid.
I manage to show it at first, using the onLoad event of the grid , but it always disappear after any grid events.

I'd like to keep it displayed to use it as research form.

Thanx !

3 Answers, 1 is accepted

Sort by
0
AspenSquare
Top achievements
Rank 1
answered on 07 Sep 2012, 07:26 PM
What does your code look like?

My 'Add new record' always displays.
0
P-A
Top achievements
Rank 1
answered on 10 Sep 2012, 07:30 AM

Just in case there is a misunderstood, what i want is to have the editing row, used for inserting, always displayed, not the "add new" button in the toolbar.

Here is the code I use :

 

For the Grid :

 

Html.Telerik().Grid<SimplePerson>()   
.Name("Grid"  
.DataKeys(c => c.Add(p => p.PersonId)) 
.Sortable(true  
.DataBinding(dataBinding => { 
   dataBinding.Ajax().Select("PagedListing", "Listing").Insert("tyyu","kuyuiy"); 
    })    
.Pageable(a => a.PageSize(20).Total(Model.UsersCount))   
.Filterable()   
.Groupable()   
.Editable(c => c.Enabled(true))   
.Sortable()   
.ClientEvents(e => e.OnLoad("Grid_onLoad").OnSave("Grid_onSave"))


And in javascript, the method that shows the editing row :

function Grid_onLoad(e) {
           var grid = $("#Grid").data("tGrid");
           grid.addRow();
       }




0
P-A
Top achievements
Rank 1
answered on 10 Sep 2012, 07:48 AM
OK, I just got it :)

I just need to add the displaying of the row in the databound handler :

.ClientEvents(e => e.OnLoad("Grid_onLoad").OnSave("Grid_onSave").OnDataBound("Grid_onLoad"))

Hope this helps someone some day :)

Tags
Grid
Asked by
P-A
Top achievements
Rank 1
Answers by
AspenSquare
Top achievements
Rank 1
P-A
Top achievements
Rank 1
Share this question
or