Replies: 1 comment
-
@series0 thank you for your questions. I think it is a much better fit for https://stackoverflow.com/questions/tagged/justpy where you might potentially reach a bigger community. I am trying short answers: Going the pandas data frame / ag grid route means that you'd love to modify aggrid javascript behavior from justpy via websockets which is understandable. There are currently no pre packaged solutions for all usecases in the justpy library and we'd love to hear from your results and see your source code in detail. That's also why i recommend stackoverflow because the community there expects detailed explanations of the problem and when the problem has been discussed it can be decided whether it is actually an issue to be discussed by the justpy developer community. Therefore i am also moving this off the issues to the discussions Question 2: Is that assignment statement correct or even advisable? What would be better? I am not in the position to answer or comment on this. Again following the stackoverflow rules will get a much better basis for discussion because detailed source code/screenshots and more comments by other community members are needed. |
Beta Was this translation helpful? Give feedback.
-
My situation is I am adding bits and pieces to an ag grid from several databases. This is an application combining several legacy systems.
So, I start with a large bulk of the information coming from mysql into a pandas dataframe and then to an ag grid for display, using justpy. Works great.
Rather like your selection list examples I render next a selection list. BUT I use another ag grid for that. That also works.
Still, the remaining task is going to a few additional databases and jamming together yet a third grid of extra information per selected item (in the second grid). This means loading a pandas df for most of the columns and then adding the remaining items to the grid in singleton fashion. It could be that I am doing this in a less than best way. I just cannot tell. There is no error and the df and grid look fine in the debugger.
When the processing returns from the first grid's row selection event, the traceback goes into an infinite loop of errors I THINK associated with rendering.
Even if I cast the value added to an int (which avoids all the trace errors), the grid DOES NOT render the singleton added columns. I need to know how to add or change grid values in singleton fashion to an existing grid, using justpy.
Right now the options only include the first field I'm adding as a singleton. Once I get that working it will be trivial to add the other dozen or so fields.
Options for that grid (field in question is Clinic ID:
grid3_options = """ { suppressColumnVirtualisation: 'True', defaultColDef: { filter: true, sortable: true, resizable: true, cellStyle: {textAlign: 'center'}, headerClass: 'font-bold' }, columnDefs: [ { field: 'Loc ID' }, { field: 'Cust ID' }, { field: 'Dest Folder' }, { field: 'Clinic ID'}, ], } """
Example with infinite error loop:
for selected in wp.selected_rows: adjusted_query = buildQuery() cursor = db.connection.cursor() df = pd.read_sql_query(adjusted_query, db.connection) grid3.options.rowData[selected]['Clinic ID'] = df['pkClinicId'][0].copy()
And all I did to remove the infinite loop of errors is cast it:
grid3.options.rowData[selected]['Clinic ID'] = int(df['pkClinicId'][0].copy())
So the question really almost comes down to syntax or change/assignment.
Since I have multiple data sources I have to 'add in' the extra grid information.
Beta Was this translation helpful? Give feedback.
All reactions