<commit_before>#= require slickgrid
#= require SlickGrid/slick.dataview
#= require SlickGrid/slick.groupitemmetadataprovider

Pancakes.SearchResultsGrid = Ember.View.extend
  columns: []
  classNames: ['grid']
  options: {}

  # Build up the SlickGrid elements.
  #
  # The grid is the only visual element here; the rest are for grouping,
  # sorting, and filtering.  They all fit in at view-level, though.
  didInsertElement: ->
    el = @$()
    groupItemMetadataProvider = new Slick.Data.GroupItemMetadataProvider

    view = new Slick.Data.DataView(
      groupItemMetadataProvider: groupItemMetadataProvider
      inlineFilters: true
    )

    grid = new Slick.Grid el, @get('view'), @get('columns'), @get('options')

    @set 'grid', grid
    @set 'view', view

    view.onRowCountChanged.subscribe (e, args) ->
      grid.updateRowCount()
      grid.render()

    view.onRowsChanged.subscribe (e, args) ->
      grid.invalidateRows(args.rows)
      grid.render()

    grid.autosizeColumns()
    grid.registerPlugin(groupItemMetadataProvider)

  # When this view is destroyed, destroy the grid and view also.
  willDestroyElement: ->
    @get('grid').destroy()
    @set 'grid', null
    @set 'view', null

# vim:ts=2:sw=2:et:tw=78<commit_msg>Fix an initialization order goof.<commit_after>#= require slickgrid
#= require SlickGrid/slick.dataview
#= require SlickGrid/slick.groupitemmetadataprovider

Pancakes.SearchResultsGrid = Ember.View.extend
  columns: []
  classNames: ['grid']
  options: {}

  # Build up the SlickGrid elements.
  #
  # The grid is the only visual element here; the rest are for grouping,
  # sorting, and filtering.  They all fit in at view-level, though.
  didInsertElement: ->
    el = @$()
    groupItemMetadataProvider = new Slick.Data.GroupItemMetadataProvider

    view = new Slick.Data.DataView(
      groupItemMetadataProvider: groupItemMetadataProvider
      inlineFilters: true
    )

    @set 'view', view

    grid = new Slick.Grid el, @get('view'), @get('columns'), @get('options')

    @set 'grid', grid

    view.onRowCountChanged.subscribe (e, args) ->
      grid.updateRowCount()
      grid.render()

    view.onRowsChanged.subscribe (e, args) ->
      grid.invalidateRows(args.rows)
      grid.render()

    grid.autosizeColumns()
    grid.registerPlugin(groupItemMetadataProvider)

  # When this view is destroyed, destroy the grid and view also.
  willDestroyElement: ->
    @get('grid').destroy()
    @set 'grid', null
    @set 'view', null

# vim:ts=2:sw=2:et:tw=78
{'fraction_non_alphanumeric': 0.11869789599047241, 'fraction_numerical': 0.0031758634378721714, 'mean_word_length': 3.5405405405405403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2648470', 'n_tokens_mistral': 811, 'n_tokens_neox': 785, 'n_words': 199}