When I click the refresh data button, the table appears blank first, and then the new data is rendered. How can I avoid this phenomenon? - ag-grid

Framework: react
Example: https://plnkr.co/edit/ONnLsqILeHCV7fyX
Current behavior
Prerequisite: set the column property cellrendererframework.
field: colName,
cellRendererFramework: CellRender,
When I click the refresh data button, the table appears blank first, and then the new data is rendered.
Expected behavior
The table does not appear blank and directly displays the latest data

Related

Updating slickgrid autocomplete fields without rerendering the grid

I'm using SlickGrid in a sharepoint environment to display and update data. To save on the the load time, I am populating auto complete fields with options that have only been used in previous lines (with tables with more than 50 lines), and then I am wanting to give the user the option to click on a "Metadata refresh button" located at the top of the autocomplete fields that will go and fetch all available options to repopulate the auto complete field.
<table><tr><td>[ TextField ] </td><td>[ AutoComplete1 ] </td><td>[ AutoComplete2]</td></tr>
<tr><td>Entry1</td><td>Hello</td><td>Goodbye</td></tr>
<tr><td>Entry2</td><td>Hi</td><td>Later</td></tr>
</table>
So if, the user was to create a new line, they would have the options of Hello and Hi in column 2, and Goodbye or Later in column 3 to choose from since they have been used before. If they want the option "Hail!" to appear in column 2, they would have to click the "Update MetaData" button for column 2, which would refresh ALL the cells in that column with all available but previously unused selections.
I know its not ideal, but its a requirement that has been given to me.
I know how to add buttons to column headers and I am updating the array of data that the grid needs for the autocomplete column, but I am at a loss on how to update the column choices without redrawing the whole grid.
Any suggestions?
Check out the newer examples in my repo: https://github.com/6pac/SlickGrid/wiki/Examples
This is probably closest to what you want:
http://6pac.github.io/SlickGrid/examples/example-autocomplete-editor.html
What I have done in the past is create a data property of the cell node to store the object, like:
$jqacContainer.data('queryautocomplete', jqac);
It's then easy enough to get the object from the cell node.
However, this requires proper cleanup of the property to avoid a memory leak. This should be able to be done in editor.destroy(), but I don't think I've checked corner cases, for example where the editor is scrolled offscreen before being completed.

Odoo v9 computed field within tree view not updating after pop-up until save record

A computed field in a tree view is not updating after returning from editing values for the line using a form view pop-up. (after the child has been saved/returning from the pop-up, but before the parent record is saved)
To give an example: add a new computed field to Sales Order Lines and then add the computed field into the Sale Order's 'ORDER LINES' tab (which itself is a tree view within the Sale Order Form). Then adjust the Sale Order Form so that editing of the Sale Order Lines is done via a form (i.e. pop-up) (rather than editing the lines within the tree, disable editable='bottom')
After testing it appears that the computed fields method is being run within the form view, the value should be updating.
The display on the line (tree view) should display the new value after returning from the pop-up, however it is not (still displays old value). (this does correctly update after the parent is saved)
This is working for other existing fields (e.g. price) which is displaying the new value on the line (tree view) after editing that value within the pop-up (before the parent is saved).
Why is the computed field showing the old value?
Try to add #api.depends('any_field_name') above compute function, it should solve your issue.
Odoo has bug about computed fields described in this issue that it doesn't computes computed fields without dependencies.
Let me know if my solution will work for you.
It appears that because the computed field was not on the form view (pop-up), even though the compute function was executing, the value on the line view after returning from the form was not updating (before a parent save).
After I added the computed field (invisible=1) to the form view (pop-up), the line view was successfully updated on return.
I do not know why, but am guessing that this is to do with cache or api. It may be possible that the line values are being updated by value returns from the form view (unsure about this), and therefore if the field in question is not on the form view then it is not being returned, and the line is remaining with the previous value.

Google Chart - DataTable inside a form

I have a table created with DataTable of Google Chart, which has a column with a drop-down list. In this way the user can set the proper value of a row.
I am working in Python and Flask and I can retrieve the request data correctly. The problem is that the table, given the amount of data, is showed in pages, each one with 20 rows. When I retrieve the request I get only those 20 rows, so I have no way to know what the user set in the other pages.
How can I get the values of all pages?
Moreover, I noticed that when I change page and then I go back, the table forgets the user changes, so I think I should be careful also to this fact.
Finally, I solved the problem by using a dictionary containing all the changes made to the table and updating the html string inside the table to keep the content updated.

Before Update Event or After Update Event (MS Access 2013)

I develop small database which gets bigger every day and I've got a situation with Before Update Event on one field.
Let's say I have main form which has subform based on the table (PONSt). The subform has one specific field (PONSt_PDV) which data depends on the other table (APP_PDV). When user updates that field (PONSt_PDV) directly in combo box, Before Update events is triggered and some calculations are done. That works perfectly!
The second situation (which is the reason for this question) is when user double clicks that combo box to open pop up form which contains the data from the other table (APP_PDV). In that pop up form user can edit, add or delete it's data and everything works great. There is a button on that pop up form which is used to get data (ID) from that table (APP_PDV), store it to the first table's field (PONSt_PDV), close the pop up form and get back to the first form (sub form on the first form, to be exact). After that, I want to recalculate other fields (in the first table PONSt) depending on the change in field (PONSt_PDV), but Before Update (or After Update) event in that case doesn't trigger at all.
What I'm doing wrong? Is there something that I can't see? Thanks!

web2py SQLFORM.factory defaults not updating

I have an SQLFORM.factory on a page that I use to(among other things) update a particular field in a table. That field is a drop down table I made like so
Field('visibility',requires=IS_IN_SET(['everyone','subscribers','friends','nobody']))
So the field in the SQLFORM.factory looks the same. The difference is that I want the default in the SQLFORM.factory to be the current value of that field in a particular table. by making a default. I do a query on the desired entry on the table, select that field, and that becomes my default, the selected option. Perfect the first time you load it up.
I do the update after the form accepts like so and the update works functionally:
if subForm.accepts(request,session,dbio=True):
if myForm.vars.visible != theDefault:
db(row).update(visibility = subForm.vars.visibility)
If you submit the page the selected option is not the current value of that field in the table, it's always the one it was previous. If I look at my database admin the table updated fine but I could not fetch the right option to select as my default. If my default was 'everyone' and then I select and submit 'friends' then the selected when the page reload after the submit is still 'everyone' If I then select and submit 'nobody', after the refresh it is 'friends'.
If it helps, I am displaying the view this SQLFORM.factory is in in and iFrame as part of a bigger page.
After many hours, here's how you do it(sorta hackey but it works)
#This is a kludge to get the right default visibility selected
if request.vars.visible == None:
visibleDefault = theDefault
else:
visibleDefault = request.vars.visible
form = SQLFORM.factory(
FIELD(Field('visible',requires=IS_IN_SET(['everyone','subscribers','friends','nobody'],zero=None),default=visibleDefault),
table_name='table')
if form.accepts(request,session,dbio=True):
if form.vars.visible != theDefault:
db(row).update(visibility = form.vars.visible)