JavaFx Printing a node without displaying it - javafx

I have a TableView where each row represents a record and I have a view button beside it which creates a new view displayed in a tab with details the record and with a print button. If I hit the print everything works fine.
Now I want to add a print button to the table view row, which does create the record view and prints it but without displaying it in a new tab. The not opening in a new tab is crucial as I later will add a print all and print selected button.
The problem is, that when I want to print it without adding it to a tab an empty page gets printed.
How can I print something without displaying it?

Related

QML ComboBox not saving selection

I have an issue similar to this post: https://forum.qt.io/topic/88519/editable-combobox-not-saving-edited-text/2
Where after I make a selection in the dropdown, if I scroll out of view and then back into view, the selection reverts back to the previous selection. I have these combo boxes in a scrollable TableView which apparently reloads elements every time they come back into view. Also, my ComboBox is not editable but I just want to be able to save the new selection I make.
I know I need to handle onAccepted, but I am not sure how to save the new value I select into the current selection that gets displayed if I leave the view then come back to it. I have 2 methods like this:
onDisplayTextChanged: {
console.log("currentText in onDisplayTextChanged: " + currentText)
onAccepted()
}
onAccepted: {
console.log("currentText in onAccepted: " + currentText)
}
I use onDisplayTextChanged to receive the new value selected that I can pass to a Python 3 script in the future, before calling onAccepted because onAccepted does not trigger for some reason after I click on a new selection. This is definitely not preferable for me though.

How to add and edit record directly on the table widget Google AppMaker?

I have something like this to enter staff details list. Above is the table list. User click button below the table to add new list record. Then fill in the list details on the form beneath it.
My question is how can I just allow user to enter/fill in the list details directly on the table itself. Not only that, also user able edit record whenever the user clicks the records and wanted to change them.
The example I am providing is specifically for a datasource in autosave mode, so you will need to make some adjustments since it appears that your datasource is in manualsave mode. First you will either want to recreate your table and in the table creator choose 'Editable' which will automatically place inputs in your table row vs labels. Alternatively you can just replace all your labels with Textboxes, Dropdowns, or whatever your input should be. See the image of the table creator below:
Since in my example I used a 'Insert Only' form I moved my 'Create Button' and my 'Clear Changes' button inside the formbody, then set the flow direction of the formbody to horizontal and then matched the spacing of the form fields to the same as my table row and dragged the formbody to be between the tableheader and the tablebody(list) element. See the image below:
Again you will want to make adjustments to fit your needs such as rearranging where your 'Save' and 'Reset' buttons appear and in manualsave mode you may be able to skip the formbody entirely since your 'Add Details' button should automatically create a new table row anyways which you will then be able to edit directly in the table, you may just need to find it first but generally new rows should just be added on the bottom of your current datasource page.

How to switch between tabs in App Maker

I have created a tabs widget that contains a table widget on the first tab. Whenever a record in the table widget is selected, the focus should switch from the first tab to the second tab as this contains more detailed data regarding the record. How can I implement such a script? Is there something like
app.currentpage.tabs.selectedtab = ...
To select second tab you can use this code snippet:
// Setting selected tab index to 1 since indices are zero-based.
app.currentPage.descendants.MyTabsWidgetName.selectedTab = 1;
This code can be placed in onClick event handler of the table's row.

EXTJS4, tabpanel and grid setup, with grid rowclick opens new tab. which overwrites each older tab

I am actually having 2 problems, and I will try to address them separately. I have a tabpanel, with a Grid in Tab1. When the tabpanel opens the Grid in Tab1 is populated with data from an AJAX call to a database. Tab1 does not have a close option, so the Grid stays populated and open. I have a rowEditor setup so that when a row in the Grid is double-clicked it opens a new Tab and populates the new tab with a new grid showing detailed content for the clicked record item in the grid from Tab1.
Now, if I double-click a record in the Grid from Tab1, a new tab opens (Tab2) and the details for the record clicked populate in the Tab2 Grid and it works fine. Now if I click another record in the Grid in Tab1, a new tab opens (Tab3) and it populates with detail results for that record clicked from Tab1. Problem is now that Tab3 is open the results for Tab3 have overwritten the results in Tab2. Where has the data I populated into tab2 gone, and how can I make sure to have each new detail record show in each new tab created? It looks like each new tab that is opening is appending the new data on each new tab, and I am getting overwrites.
Ideally I want to have the Grid in Tab1 open with an index of records and each double click on a record opens a new tabpanel with the detail results for that record clicked.
My second problem is that when I close a tab I am finding that the grid in Tab1 is refreshing when I am not telling it to refresh. as a result I am getting errors because I am not passing required parameters for the Grid in Tab1 to refresh.
My guess is that you have references to the same stores or the same grid config from multiple tabs. Instead what you want to do is to have separate instances of both the grids and the stores in each tab that you open. That way you wont have collisions.
The issue with the grid reloading on tab change is strange as that is not the default behavior. Check your tabpanel config and listeners for any overzealous reloads.

limit the record displayed in a view using hook_views_query_alter

i want to change the number of items returned by a view. I changed the code as
$view->set_items_per_page(2);
in hook_views_query_alter();
But it is not showing the required result. But there is color difference after 2 records. Is it required any other settings I put my pager as off in view.
ie Use Pager:off . I want to use this on draggable view table. Is it possible?
Pls help me
if you are only altering the query programmatically and view exist then
1] Go to your view basic settings and click on item to display
bottom of your view you will get the 2 text boxes.
2] In first text box put the number you want, in your case put 2 and leave second text box 0. and hit the update default display button and save your view.

Resources