Version 1
Version 1

Creating an editForm Template

In DataViewsJS, you can use the editRowTemplate property to customize the built-in editors.

Use the following steps to customize the editors using the row template.

editForm Editor

Sample Code

  1. Design the form inside the template element with a unique ID.
<div class="setting-container">
  <select id="grid-edit-mode">
    <option value="popup">popup</option>
    <option value="editForm" selected>editForm</option>
<div id="grid1" class="grid" style="height:90%;"></div>
<template id="editRowTemplate" style="display: none">
  <div class="edit-row">
    <div class="edit-detail">
      <label class="column1">First Name</label>
      <input class="column2" data-column="firstName" />
    <div class="edit-detail">
      <label class="column1">Last Name</label>
      <input class="column2" data-column="lastName" />
  <div class="edit-row">
    <div class="edit-detail">
      <label class="column1">Score</label>
      <input class="column2" data-column="score" />
    <div class="edit-detail">
      <label class="column1">Position</label>
      <select class="column2" data-column="position">
        <option>Sales Manager</option>
        <option>Web Developer</option>
        <option>.NET Developer</option>
        <option>Admin Assistant</option>
  <div class="edit-advantage edit-detail">
    <label class="column1">Advantage</label>
    <textarea data-column="advantage"></textarea>
  1. While initializing the code, add the editRowTemplate property to the grid and use the template ID preceded by a '#'.
var dataView = new GC.DataViews.DataView(
  new GC.DataViews.GridLayout({
    allowEditing: true,
    editRowTemplate: '#editRowTemplate',
    editMode: 'editForm',
    rowHeight: 40,

$('#grid-edit-mode').change(function () {
  var sel = document.getElementById('grid-edit-mode');
  dataView.layoutEngine.options.editMode = sel.options[sel.selectedIndex].value;

See also