bagya
bagya

Reputation: 399

How to stop adding empty rows in Kendo Grid?

In my kendo grid while adding new record using the mode "popup or inline". It is adding well but the same time if I click with empty values also it's adding empty row in grid. Whether I want to give validation for that field or any other way to do that. And if my dataSource assigment inside of kendo grid, how can I put dataSource.sync() method.

In this grid I want to perform CRUD(Create,Read(View),Update,Delete) operation on client side.

Here the Dojo Link.. http://dojo.telerik.com/Ikoke

Upvotes: 0

Views: 2351

Answers (1)

cycopepe
cycopepe

Reputation: 551

You can easily perform validation updating your grid_save function, accessing the model.

function grid_save(e) { // function to add a save event is kendoGrids
        var model = e.model;
        if (model.isNew()) { 
          if(e.model.Rate.length >0){ // here you can make validations via e.model
            model.set("operationContext", "IsAdded");
          }
        } else {
          model.set("operationContext", "IsUpdate");
        }
      }

Upvotes: 1

Related Questions