SlickGrid cell styling lost on Sort - javascript

When sorting the rows in SlickGrid, it seems that they are all destroyed and recreated, thus losing the CSS classes that may have been added at run-time.
For example, I want rows that are "dirty" (that is, have been edited but not yet saved)((I don't auto-commit, but use a Save button on the grid to persist data)) to display differently, specifically displaying a "dirty" icon.
So, when a row is "dirty", one of its cells (an icon column) gains a CSS class to display the proper icon. This however is then lost when rows are sorted. Is there a way to avoid the creation of brand new rows on a sort? Or a different method to accomplish this task?
Thanks!

SlickGrid explicitly forbids direct manipulation of the DOM elements it creates with the exception of editors. If you need to decorate a cell/row with a CSS class, do so using the APIs provided by SlickGrid (custom formatters, row/cell metadata, addCellCssStyles, etc.). That way, they will persist across re-renders.

Related

Handle long time sorting in ag-grid (pure JS)

I am working with a big amount of data (1M - 5M), and rows in the grid should be groupable, sortable, and filterable. As ag-grid can populate table with data quickly enough, I use in-memory row model to satisfy requirements.
However, when I click column in order to sort all rows by this column, it takes some time to do this. Moreover, sequential clicking on columns while rows are still being sorted may crash grid as well as browser application.
Are there any ways to prevent user from clicking on columns (disable sorting, show loading overlay, or something like this)?
I am trying to use beforeSortChanged and afterSortChanged events to show overlay or modify DOM elements (to make grid a little bit grey and show loading circle), but it doesn't work properly: beforeSortChanged event handler seems to be stuck for a moment and then only executed.
Ag-grid is used inside Ember framework as a component.
How about using onCellClicked which is an attribute of the columnDefs. Should work in a similar manner to what you are looking for with beforeSortChanged.

How to get a list of all tables that have datatables applied?

I need a list of all tables that have jQuery DataTables applied. I searched the docs and the API but I could not find an array or something like that that holds the tables.
You're looking for $.fn.dataTable.tables() - DataTables's static function.
It can be useful to be able to get a list of the existing DataTables
on a page, particularly in situations where the table has scrolling
enabled and needs to have its column widths adjusted when it is made
visible. This method provides that ability.

Displaying sub-data rows inside a row in SlickGrid Table

I've started using SlickGrid and have to implement a kind of functionality where I need to show sub-row inside a parent row of SlickGrid.
Here's the scenario
Here's Asia, Europe is having sub categories in Services Column and these service columns are expandable/collapsible
I'm trying to customize this for first column.
Is any other link/source available to refer to accomplish the feature.
Are you aware of the grouping/aggregates example ?
http://mleibman.github.io/SlickGrid/examples/example-grouping
This offers very similar behaviour, but the exact 'cell-merging' behaviour you show is not currently available in SlickGrid. Slickgrid tends to use tree structures rather than a flat structure. That said, it may not be too hard to hack up, but it seems everyone wants a different visual layout and it becomes very hard to support them all.
If you don't need editing or scrolling, I'd suggest this would work best as an HTML table, or even a PDF.

Dojo Datagrid Sorting Mask

I'm currently working with a dojo datagrid that works perfectly well except for one small problem. Due to a large number of fields that must be accounted for, clicking on a column to sort the contents of the grid by the value within that column can be rather time consuming (several seconds). Is there any way to display to my users that the content of the grid is "loading"/"sorting"/etc during this downtime? I've looked around the web but only found loading masks and no sorting masks. As far as I can tell there are no built-in methods for detecting sorting or changes in sorting.
Thanks in advance.
This Post handles the onHeaderCellClick event which would catch the onClick in the header.
Declarative dojox.grid.datagrid's header has onclick event?
Theres a fiddle in the Post, which disrcibes it very well.
You can use it to make a loadingimage visible and hide it again, when sortig ends.
Regards, Miriam

Displaying a component in EditorGridPanel without clicking

Is there a way to display a component in EditorGridPanel without the need to click on the cell?
The problem I see on this demo is that the checkboxes are not Ext.form.Checkbox components, and not even inherited from it. The checkboxes are simply background images and since I am building a grid that needs ComboBoxes, it will not be simple to apply a similar hack.
Ok, I see what you're after now. Immediately display the combobox on each row upon grid rendering. That might be difficult to achieve, and I suspect it might have a negative effect on the overall performance of the grid (multiple comboboxes to render instead of just one).
In any case, have you looked at the clicksToEdit config option of EditorGridPanel? From ExtJS documentation:
The number of clicks on a cell
required to display the cell's editor
(defaults to 2).
Setting this option to 'auto' means
that mousedown on the selected cell
starts editing that cell.
How about if you tried setting this to 'auto'? That would at least reduce the amount of mouseclicks that the user has to do, before editing starts. Is that what you're really after with this?
(Note that I haven't tried this option myself, so I don't know how well it actually works with Comboboxes.)

Categories