ag-grid refresh rowStyle to default after redux action - ag-grid

I have a react-redux app, where in my ag-grid I use getRowStyle to set rows based on a certain field value. For instance, if a row's edited I set a field called isDirty to true and pass this to redux, which updates state and then via props I get this back and page re-renders and makes use of getRowStyle to set this row to a diff style, like below -
_getRowStyle = params => {
if (params.node.data.isDirty) {
return {'fontWeight': 'bold'};
}
};
But, once this is persisted somewhere (thru' my redux-action), I update the state's isDirty to false. Again, this is received via props, and re-renders, but now in _getRowStyle() the "if" is no longer true, so it doesn't default back to the original value, so the row remains in "bold" style. If I force a gridApi.redrawRows(), it renders correctly, but I want to see if I can somehow avoid this heavy operation. All that is needed a refresh, but refreshCells() doesn't give me what I'm after.
Any assistance is deeply appreciated!

Related

Tabulator column.setWidth() not saving to history

I have a headerMenu dropdown to "show" and "hide" columns, and persistence is set to true. When I manually resize the columns the new width is persistent, but it is not when using the dropdown (the column does resize, however, it just doesn't stay that way on the next reload). I noticed that the columnResized callback is also not triggered by my code.
var headerMenu = [
{
label:"Hide Column",
action:function(e, column){
column.setWidth(40);
}
},
Am I missing something here? How do I get this to work and be persistent?
This is the correct behaviour, and fairly standard across a range of table functions and callbacks
Both the callback and the persistence module only track user interaction with the table. This allows maximum flexibility for the developer to call additional functions on the table with out interfering with the direct user experience.
In your case you appear to be trying to hide a column by changing its width? there is a hide function you can call on a column to hide it, if that is what y0u are attempting.
column.hide()

Null Values in Checkbox Custom Fields

I'm noticing that editing a matter from the web interface and adding a checkbox custom field to the matter does not automatically set that checkbox to 'false.' Instead, unless you set the box to true, save it, and then re-edit it to uncheck that box, you cannot get a subsequent api call to return a 'false' value.
It strikes me that this ought to be corrected?
This is Matt G. from Clio's API support team.
You're correct that checkbox custom fields don't return a false value unless thy're actually toggled on and then off. Until some value is set, the checkbox field won't have any information stored in it and will return a null value.
We'll evaluate the functionality and look into updating how checkboxes work. In the meantime, if you want to get records of all Matters with an unchecked checkbox, you can look for Custom Field Values that are false and null.

angular2 formcontrol stays dirty even if set to original value

When I change a value in an input field, the corresponding form-control is set to dirty. When I revert my change (by typing in the input field) the form-control stays dirty. Is this intended, is this a bug or do I do something wrong?
Well, yes it's intended to work that way since:
A control is dirty if the user has changed the value in the UI. (docs entry)
..and not if the value is different from the starting value.
In case you want to revert the dirty state you could use the markAsPristine() (docs entry) on your AbstractControl. (eg trigger it by click on a button or when subscribing to the valueChanges observable of the AbstractControl and compare the new value to a previously stored one...)

GWT DataTable TextInputCell is not showing the correct value

I have a DataGrid with a TextInputCell column, using a ListDataProvider. When the value in a cell is changed I am creating a RequestContext and calling RequestContext#edit with the original entity for the row that is being edited. I then set the field in the mutable version of the proxy to the value from the edited cell. This all works nicely, and I can save the change successfully to the database. However, on the server I modify the value before saving the change, and send the modified entity (DTO) back to the client. In the Receiver#onSuccess method I store the new entity in the list data provider, and then call ListDataProvider#refresh. But the value that is shown in the DataGrid doesn't change to reflect the modification on the server. I've looked at the value that is supplied to the TextInputCell#getValue method, and it is correct, that is, it is the value that contains the modification applied on the server.
I tried creating another column in the grid that is just a TextCell, and supplied the same value in getValue for that cell; in this case the displayed value is correctly updated by the refresh, reflecting the modified value that was returned from the server.
So, my question is: where does the cell get its value? When I look at the value returned by my TextInputCell#getValue method it appears to be the correct value, but that value is not being shown on the screen (the value shown on the screen is the value that was in the proxy object prior to sending the request to the server).
Note: I looked at this question, but it did not work in my situation.
I have a very similar problem.
I have a page showing a grid with two column: the first one has check boxes instead of text.
The value of the check box is given by:
public Boolean getValue(Item item) {
return selectedItems.contains(item);
}
When the user checks a check box, I store the value in a map (selectedItems).
At the bottom of the page there is a "Clear" button that reset the map and calls the table redraw, but the status of the check boxes does not revert to the original status (i.e. the check boxes stay selected).
Debugging the code I've found that getValue() returns the correct value, but is like the table caches the cells.
The only workaround I have found, without rebuilding the whole table, was to remove the check boxes' cell and add it again on "Clear".
itemsTable.removeColumn(0);
itemsTable.insertColumn(0, makeSelectionColumn());
The method makeSelectionColumn() must return a new cell.

wicket: Dropdownchoice

i have two dropdowns using same model and sets the value into it. Dropdown1 will visible on screen always and Dropdown2, will be visible for only one particular option choosen in Dropdown1. and i am making an query to the DB based on the selections in dropdowns.
But when i have both the dropdown first and then hide the second one, The value already set but the Dropdown2 is still avalible in my model, and making my query to fetch improper data.
So can any one suggest me an idea, how to set the value to null for the attribute which is actually set but dropdown2, if dropdown2 is inVisible.
(i tried to set the ModelObject to null, when making the dropdown2 invisible (using AjaxFormComponentupdateBehavior), but when i make the dropdown2, visible again, it returns null,even if i make any selection in it)
Are you using a LoadableDetachableModel ? try to explicitly detach model from that dropdown on setHide event. I did not try it though.