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

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.

Related

DHTMLX - Grid multiselection with smart rendering

I'm using a dhtmlx-grid and have a problem in the following use case.
I enabled multiple selection and the grid uses smart rendering to load a large set of data.
After the initial load, I select the first row in the grid, and then drag down the scrollbar to the last row and shift-click the last row.
The expected behavior is that all the rows in the grid should be selected, but this isn't the case.
The not-rendered-rows in between are not selected.
Glad if somebody can suggest me some good solution.
Thanks
Unfortunately, only the rendered rows can be selected, so in case of enabled smart rendering mode you cannot implement the described steps. The only solution is to disable the smart rendering mode.

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

Drag and drop Table headers

I've found a few plugins that does this, but they either have more than what I want which gets in the way and none of them do exactly what I need. Some I simply can't get to work with firebug showing syntax errors in the style sheets even though it seems perfectly fine.
I want something very simple in terms of visuals. Basically I want this:
http://demos.devexpress.com/aspxgridviewdemos/groupingsorting/grouping.aspx
If you look at the link then you will see that you can re-order the columns by dragging the headers, but you can also drag the headers out to where it says "Drag a column header here to group by that column"
I just want a plain way to do this in javascript/jquery with some callback so I can store the column order in an array after you change the order. The data changes I can handle, it's the dragging of the columns and then changing the order or removing the column and adding it to the Group space above that I have issues with.
We actually do you devexpress controls, but for what we're doing it's to slow with all the callbacks their grid needs to do when you do anything on the thing. So we're in the process of creating our own ajax grid that does what we want and how we want it with only what we need.
I hope this makes sense and that someone can help.
I have recently looked at implementing something similar, so while I can't post a code example, I'd recommend looking at jQuery UI Draggable to let you drag the columns to where you want them.
Make the table column order configurable through javascript first. Then make the column headings draggable and based on the new position redraw the table based on the new column layout.
This approach should be faster as you can optimise for your use cases.

SlickGrid cell styling lost on Sort

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.

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