question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

version 2.x refactoring to support Multiple Grid

See original GitHub issue

Here’s a list of what cannot be done currently in version 1.x until a new major release comes out 2.x which mean breaking changes

  • 1. GridEvent Service, no longer references the 2nd argument gridOptions (closed by PR #51)
  • 2. a lot of the Services instantiated in aurelia-slickgrid ViewModel use an init() which usually ask for init(grid, gridOptions, dataView) but once we get the grid object, we actually have access to the gridOptions, so we can simplify this a lot (closed by PR #55).
  • 3. remove all deprecated code (just search for the word deprecated), code change could be renamed or re-implemented
    • a. onBackendEventApi was re-implemented and replaced by backendServiceApi (commit)
  • 4. remove possibly unnecessary global Event Aggregators (EA) by Element Dispatch (ED)
    • ~a. to be discussed, having EA globally might help in some cases, in my current project I have a left side menu that when triggered needs to resize the grid (autoResize doesn’t work in that case) and I don’t think it would be possible without an EA.~
    • b. use asg for Aurelia Events and sg for SlickGrid/DataView Events & rename eventPrefix to slickgridEventPrefix (commit)
  • 5. Filter could only use searchTerms array instead of doing multiple logic to deal with searchTerm (singular) and searchTerms array (commit).
  • 6. Remove all previous reference of selectOptions in all Filters (commit)
  • 7. Editors/Filters should use a common Column property and possibly remove the filter Column property.
  • 8. remove FormElementType from Filters, it should only use FilterType (commit)
    • a. the FormElementType is actually not used anywhere else I think, so might be better to delete it completely
  • 9. BackendService API onFilterChanged Event and function should not be named the same, it is rather confusing when troubleshooting, maybe change function to processFilterChanged (commit)
  • 10. remove exportWithFormatter from GridOptions.interface since it is now part of exportOptions (commit)
  • 11. GridMenu has both hideX and showX flags, they should all be hideX since that is the default name in the external plugins (commit)
  • 12. Possibly rename the GridExtraService to simply GridService (commit)
  • 13. A lot of the Editors properties (like collection) are available only from the generic params property which removes the benefit of intellisense and type check. This goes with number 7.
  • 14. Remove the initOptions from the BackendService, that was replaced by init some time ago (commit)
  • 15. GridExtraUtil contain only 1 function, it would be better to move it into the renamed GridService and delete GridExtraUtil completely (commit)
  • 16. Should pass i18n as a Grid Options instead of a generic params grid option and fix a column picker issue (commit)
  • 17. change all Singleton Services to non-Singleton (commit)
  • 18. renamed onGridStateServiceChanged to onGridStateChanged
  • 19. add multiple grids in a view (commit and commit)
  • 20. change column.interface signature of onCellClick and onCellChange to expose event as first argument to keep consistent with SlickGrid, see issue #60
  • 21. update Migration Guide
  • 22. update all client-cli and GitHub demo samples
  • 23. update Wikis and there’s a lot

This list will be taken into consideration in the version 2.x which will be a Major and breaking version. Simply keeping this for reference as of now.

Also, don’t expect a version 2.x any time soon. This will be addressed only when we decided that all features that we want are in place and we want to get rid of all properties and naming that weren’t of good use in 1.x.

Migration Guide will be available here

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:108 (59 by maintainers)

github_iconTop GitHub Comments

1reaction
jmzagorskicommented, Jun 7, 2018

Right, formatters are more challenging. Two methods I can think of off the top of my head right now:

  1. You would have to define an interface for the user to use so your library knew what function to call on the class after it was instantiated
  2. Or the user would have to create a class with their dependencies as the first parameters to their class constructor and then factory.of feeds the rest of the arguments to the constructor, similar to the editor. Then when slickgrid runs it will be calling this Aurelia’s invoke every time (not sure what type of overhead that brings) For example:
@inject(i18n)
export class MyFormatter {
  constructor(i8n i8n, row, cell, value, columnDef, dataContext) {
  }
}

I am sure there are better ways and I can think of some as I am going through my code.

1reaction
ghiscodingcommented, Jun 4, 2018

Actually, it only works after I did the change. Can you update the numberFilterCondition.ts with this code

export const numberFilterCondition: FilterCondition = (options: FilterConditionOption) => {
  const cellValue = parseFloat(options.cellValue);
  let searchTerm = (Array.isArray(options.searchTerms) && options.searchTerms[0]) || 0;
  if (typeof searchTerm === 'string') {
    searchTerm = parseFloat(searchTerm);
  }

+  if (!searchTerm && (!options.operator || options.operator === '')) {
+    return true;
+  }
  return testFilterCondition(options.operator || '==', cellValue, searchTerm);
};

Try it out and see if that is the behavior you want, you can tweak it if necessary.

We might also have to revisit the other conditions

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accelerating Multigrid-based Hierarchical Scientific ... - OSTI.gov
1: Example of hierarchical data refactoring helping optimize data movement in scientific workflows by intelligently moving each coefficient class across.
Read more >
Accelerating Multigrid-based Hierarchical Scientific ... - arXiv
In §IV, we demonstrate our design by implementing the state-of-the-art non-uniform multi-dimensional multigrid- based data refactoring algorithms of Ainsworth ...
Read more >
Confluence Mobile - wiki.ucar.edu
The 2.x VDC provides no support whatsoever for unstructured grids: tessellations of Euclidean space by simple shapes, such as tetrahedra, in an irregular ......
Read more >
2. Proposed Refactoring Implementation — GMT 6.5.0 ...
The GMT API as of GMT 6.x is an unusual beast as far as APIs go. ... 15x15 arc-second grid for all the...
Read more >
Grid Template Columns - Tailwind CSS
Utilities for specifying the columns in a grid layout. ... grid-cols-2, grid-template-columns: repeat(2, minmax(0, 1fr));.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found