Demo - Read-Only, Required Columns

by Manish Gupta

HTML

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>
<div class="container">

  <h3>
    Enter text in MultiLine    
  </h3>
  <p>
  The FlexGrid allows built-in editing in MultiLine for a column. By default MultiLine editing remains disabled. To enable multiline editing, Column <b>multiLine</b> property should be set to true. 
  </p>
  <p>
  To show multiline content after editing, the edited row should be reszied according to the content. To resize edited row, <b>autoSizeRow</b> method should be called in <b>rowEditEnded</b> event.
  </p>
  <p>
  In this sample, the multiline editing is allowed for Country column.
  </p>
  <div id="theGrid">
  </div>
</div>

CSS

.wj-flexgrid {
  max-height: 200px;
  margin-bottom: 12px;
}

body {
  margin-bottom: 24px;
}

JavaScript

onload = function() {

  // create some random data
  var countries = 'US,Germany,UK,Japan,Sweden,Norway,Denmark'.split(',');
  var data = [];
  for (var i = 0; i < countries.length; i++) {
    data.push({
    	id: i,
      country: countries[i],
      sales: Math.random() * 10000,
      expenses: Math.random() * 5000,
      overdue: (i + 1) % 4 == 0
    });
  }

  // default clipboard behavior
  var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
    itemsSource: data,
    columns: [
    	{ binding: 'id', header: 'ID', width: 50, isReadOnly: true },
    	{ binding: 'country', header: 'Country', isRequired: true, multiLine:true},
    	{ binding: 'sales', header: 'Sales', isRequired: false },
    	{ binding: 'expenses', header: 'Expenses', isRequired: false },
    	{ binding: 'overdue', header: 'Overdue' }
    ],
    rowEditEnded: function(s, e) {
    	s.autoSizeRow(e.row);
    }
  });
}