<commit_before>var data = [{
  "id": "978-0641723445",
  "cat": ["book", "hardcover"],
  "name": "The Lightning Thief",
  "author": "<NAME>",
  "series_t": "Percy Jackson and the Olympians",
  "sequence_i": 1,
  "genre_s": "fantasy",
  "inStock": true,
  "price": 12.50,
  "pages_i": 384
}, {
  "id": "978-1423103349",
  "cat": "book",
  "name": "The Sea of Monsters",
  "author": "<NAME>",
  "series_t": "Percy Jackson and the Olympians",
  "sequence_i": 2,
  "genre_s": "fantasy",
  "inStock": true,
  "price": 6.49,
  "pages_i": 304
}, {
  "id": "978-1857995879",
  "cat": "book",
  "name": "Sophie's World : The Greek Philosophers",
  "author": "<NAME>",
  "sequence_i": 1,
  "genre_s": "fantasy",
  "inStock": true,
  "price": 3.07,
  "pages_i": 64
}, {
  "id": "978-1933988177",
  "cat": "book",
  "name": "Lucene in Action, Second Edition",
  "author": "<NAME>",
  "sequence_i": 1,
  "genre_s": "IT",
  "inStock": true,
  "price": 30.50,
  "pages_i": 475
}];

EW.define("MainViewport", {
  alias: "mainViewport",
  view: "layout",
  rows: [{
    view: "template",
    type: "header",
    template: "Grid binding example"
  }, {
    view: "datatable",
    itemId: "gridProducts",
    columns: [{id: "author", header: "Author", width: 200},
      {id: "name", header: "Title", width: 160},
      {id: "genre_s", header: "Genre", width: 100},
      {id: "cat", header: "Product Group", width: 200}],
    select: "row",
    data: data
  }, {
    view: "template",
    itemId: "details",
    template: "Title: <a href=\"#\">#name#</a><br>" +
      "Author: #author#<br>" +
      "Genre: #genre_s#<br>" +
      "Product Group: #cat#",
    data: data[0]
  }]
});

EW.defineController("Binding", {
  views: [],
  init: function () {
    return {
      mainViewport: {
        "#gridProducts": {
          onSelectChange: this.onSelectProduct
        }
      }
    };
  },
  onSelectProduct: function () {
    var product = this.getSelectedItem();
      details = EW.find(this, "#details");
    details.data = product;
    details.refresh();
  }
});

EW.application({
  name: "BT",
  requires: [],
  autoViewport: true
});<commit_msg>change first example to real binding<commit_after>var data = [{
  "id": "978-0641723445",
  "cat": ["book", "hardcover"],
  "name": "The Lightning Thief",
  "author": "<NAME>",
  "series_t": "<NAME> and the Olympians",
  "sequence_i": 1,
  "genre_s": "fantasy",
  "inStock": true,
  "price": 12.50,
  "pages_i": 384
}, {
  "id": "978-1423103349",
  "cat": "book",
  "name": "The Sea of Monsters",
  "author": "<NAME>",
  "series_t": "<NAME> and the Olympians",
  "sequence_i": 2,
  "genre_s": "fantasy",
  "inStock": true,
  "price": 6.49,
  "pages_i": 304
}, {
  "id": "978-1857995879",
  "cat": "book",
  "name": "Sophie's World : The Greek Philosophers",
  "author": "<NAME>",
  "sequence_i": 1,
  "genre_s": "fantasy",
  "inStock": true,
  "price": 3.07,
  "pages_i": 64
}, {
  "id": "978-1933988177",
  "cat": "book",
  "name": "Lucene in Action, Second Edition",
  "author": "<NAME>",
  "sequence_i": 1,
  "genre_s": "IT",
  "inStock": true,
  "price": 30.50,
  "pages_i": 475
}];

EW.define("MainViewport", {
  alias: "mainViewport",
  view: "layout",
  rows: [{
    view: "template",
    type: "header",
    template: "Grid binding example"
  }, {
    view: "datatable",
    itemId: "gridProducts",
    columns: [{id: "author", header: "Author", width: 200},
      {id: "name", header: "Title", width: 160},
      {id: "genre_s", header: "Genre", width: 100},
      {id: "cat", header: "Product Group", width: 200}],
    select: "row",
    defaultData: data[0],
    data: data
  }, {
    view: "template",
    itemId: "details",    
    template: "Title: <a href=\"#\">#name#</a><br>" +
      "Author: #author#<br>" +
      "Genre: #genre_s#<br>" +
      "Product Group: #cat#"    
  }]
});

EW.defineController("Binding", {
  views: [],
  init: function () {
    return {
      mainViewport: {
        "#gridProducts": {
          onSelectChange: this.onSelectProduct
        }
      }
    };
  },
  onSelectProduct: function () {
    var product = this.getSelectedItem();
      details = EW.find(this, "#details");
    details.data = product;
    details.refresh();
  }
});

EW.application({
  name: "BT",
  requires: [],
  autoViewport: true,
  launch: function (viewport) {
    var detailsTemplate = EW.find(viewport, "#details"),
      gridProducts = EW.find(viewport, "#gridProducts");
    detailsTemplate.bind(gridProducts);
  }
});
{'fraction_non_alphanumeric': 0.2143335565974548, 'fraction_numerical': 0.04197365483366823, 'mean_word_length': 3.234404536862004, 'pattern_counts': {'":': 78, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6398464', 'n_tokens_mistral': 1860, 'n_tokens_neox': 1698, 'n_words': 396}