1

See example

I want to conditionally show rows as editable when the datasource is lacking values.

The purpose is to have a predefine values for users on page load

Only thing that kinda works is adding grid.editRow(row) for the databound but this only works if there is a single item and this disables firing of my inline buttons

        function AddPreDefinedValues(){
            setTimeout(function () {
              var grid = $('#logGrid').data('kendoGrid');
              var data = worklogDataSource.data();
              var i = 0;

                console.log('**** check items: '+data.length);
                for(var item in data){
                    var newIndex = 0;
                     if(i != 0){
                         newIndex = i - 1;
                     }
                    if(data[item].Id === null){
                        console.log('************** '+newIndex);
                        var s = '#logGrid tr:has(td):eq('+newIndex+')';
                         grid.editRow($(s));
                    }
                    i++;
                }    

              }, 0);
        }

When data source has complete value, show row as read only but when a value is missing for a field then show row in edit mode

  • I am not sure If I get you correctly. but you can display Edit button conditionally. based on some flag you show or hide Edit button on the Row. [For example](https://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/editing/show-command-buttons-conditionally) – Diptee Hamdapurkar Jun 20 '19 at 09:48
  • I've added the sample of what I'm trying to achieve on the problem description. – Desarapen Penpen Jun 20 '19 at 14:32
  • You mean you want many rows at once open for edition? What's your grid's editable mode: "incell", "inline" or "popup"? – GaloisGirl Jun 25 '19 at 15:43

1 Answers1

0

You mean you want many rows at once open for edition?

We've already established grid.editRow(row) won't work, since it edits only one single row.

A common case to have a field immediately editable is a boolean column with a checkbox editor, and you can search for some threads about it like this one.

Basically, what you need to do is:

  1. render the editor yourself in the template
  2. prevent kendo from making its own editor by setting the column as not editable
  3. bind the change event on your custom editor to update the model

It's a lot of work, especially rendering all the different editors.

An alternative is adding a marker in your template like an exclamation point that would attract the user's attention, with a tooltip that explains they need to fill this value.

GaloisGirl
  • 1,476
  • 1
  • 8
  • 14