BindingNavigator: AddItem button saves the form, but does not clear the form for the new Record - visual-studio-2017

I have a Visual Basic project that uses a form to save information to a XML database. The form controls are bound to a DataTableBindingSource and all is fine except the "AddNewItem" button on the BindingNavigator seems to be saving the form. This is not the behavior I expected since there is also a SaveItem button that works great for saving the data to the DataTable. And since I wish to automatically clear the form for a new record after saving, I wrote a routine that clears all the TextBoxes, CheckBoxes, DropDowns, etc… when the SaveItem is clicked. The SaveItem also writes the DataSet to the XML database so no data is lost, but then when I click the AddItem button, it saves the Cleared form over the existing record in the DataTable, so when I click the SaveItem the altered DateTable gets written to the XML Database.
Is there any way to grab the control of the AddItem button and alter its behavior so that it doesn’t save the form, or am I not seeing a bigger problem if I did that?
I Know I could write my own AddNewItem routine, but the button would be in the wrong place…

Related

How can I display a Success Message on transition at the source page? (Oracle APEX 21.1)

I have 2 pages in an application. P11 (Name: BASE FORM PAGE. It is Normal Page) and P12 (Name: SHOP DATA COMMIT DIALOG. It is a Modal Dialog.)
SHOP DATA COMMIT DIALOG has a form. This form is working for registration a shop data to the Database.
When success to insert a data to DB, I want close this dialog, and display message on right up side of the BASE FORM PAGE.
It would be better if the name of the store entered in the dialog could be included in the message. Like "Success! Add a data of :P12_SHOP_NAME".
I have tried some settings on SHOP DATA COMMIT DIALOG page. But it does not show me a message on BASE FORM PAGE.
Processes - Identification: [Close Dialog]. I set a value in Settings - Item to Return.
Processes - Identification: [Close Dialog]. I set a value in Success Message.
Seriously it is not easy to me. Is there anyone to give me an answer or something hint?
Thank you for your kindness to read this message.
On a Modal dialog page, there's the "Process form" process whose type is "Automatic Row Processing (DML)" - Apex creates it automatically. It is responsible for inserting new rows or updating (or deleting) existing ones.
By default, when you create (or apply changes), it returns a built-in message (e.g. "Row updated"). If you want to change the message, navigate to process' properties, scroll down to "Success Message" property and type something like this in there:
Success! Add a data of &P12_SHOP_NAME.
Pay attention to leading & and trailing . for &P12_SHOP_NAME.
So, when you create a new row, you'll see
Success! Add a data of ZARA
message in upper right corner of the Normal page.

Django multi-select widget. Add arbitrary select components

i would like to make a widget that lets the user select a value from a drop-down list and then add new drop-down lists with values filtered based on the previous selections. I don't know where to start from....
If the amount of drop-downs is finite and determinable by the time you develop the software (e.g. selecting country->city->street) I would suggest to:
add all the extra dropdowns (without data yet) to your form, make sure they are hidden
use jqueryui to un-hide and populate the dropdowns as needed using ajax
Don't forget to disable/hide the whole form by default and only show it if JS is enabled in browser.
Also, you will of course need another view, with which only ajax speaks.
Here for you to catch the idea how the stuff should work. Sorry don't know if they have anything more similar. But: user selects something -> jquery requests data for the next dropdown -> jquery displays next populated dropdown.

Sitecore 8, MVC, Experience Editor: How to make a rendering refresh after a Field Editor Button has been used

We have a rendering listing the selected items in a TreeSelect in the current item. In our case we call them "Tags" (1)
We have added a Field Editor Button to the component to let the editor change selected items. (2) (As described on for example Adding a custom component)
When an editor clicks (2) the editor window (3) it is opened in a dialog. The editor may select different items(called tags in our case) using the TreeSelect.
When the editor presses the ok-button (4) the values are set.
Now to the problem:
The values are actually set as they get stored when the editor presses the Save button but we want our list on the page (1) to immediately reflect the set items when the editor presses the ok-button (4), i.e. before having to actually save the whole item.
How do we achieve that?
(I am in contacts with Sitecore support but so far I have not gotten any answers...)
Update
After a lot of conversation with the support we still have no useful solution.
We tried turning it into a field renderer displaying the links.
What worked was:
The field do get updated when you have edited it in the popup field editor. (but...)
It looks good the first time when page is loaded.
You can make a WebEdit button with commands to edit the field and add it as Custom button to the field (register <command name="webedit:fieldeditor" type="Sitecore.Shell.Applications.WebEdit.Commands.FieldEditor, Sitecore.Client"/> and set Click on the button to webedit:fieldeditor(command={3473DDA1-2983-493C-AF7A-054C75AA7AD3},fields=NameOfField where the guid points to itelf and an "Icon" is set on it.)
What didn't work was:
The field get updated by the raw value, not what I want to display. Server code is involved, but not in the rendering of html-code.
When I want to edit the value in the field editor, the value sent to the field editor is not the raw value but what actually is displayed on the page. (I guess this can be solved somehow)
The issue to the support turned into a feature request to let the server be involved in rendering the field, not just sending a new value to the JavaScript updating it. The server does the first rendering so when it already is involved in updating, it should be allowed to do the rendering the following times too.
We have decided to not spend more time on this right now (we have other things to do too.) and have a bad editor experience as the field not get updated until the editor actually saves the item.
Still we have no suitable solution for this issue. If you want to keep working on it and want a reference to my issue it is 439059.
This may not be useful here. I've done this in normal sites, but not in Sitecore. But, here's one possibility....
This is a situation where you would pass a callback function to the child popup window. This callback will cause the caller / parent window to re-read/re-load the information that was just updated by the child.
Example:
User presses (2) to open Editor Window(3) (Editor window is opened and the Callback function is passed as a parameter)
User presses "OK" button (4). The "OK" button event handler updates the changes, then calls the Callback function which re-loads the now updated information, and closes the popup window.
Once the popup closes, the parent window now displays the information that the popup/editor just updated.
This takes some client side javascript (jquery) development but it is quite do-able normally.

Rolling back an unsaved record? Cancelling an edit of a record should revert to its state prior to the edit, not to the blank state

In my app, i let the user create a record on clientside and fiddle with it prior to saving. The record is of a pretty complex model with a lot of realtionships. To edit the record, a modal dialog opens and displays a form.
Example scenario:
You've created a new record on client side. It's in the blank state.
Then you proceed to edit the record. You make changes to the form in the modal dialog and press OK. The record now is in state A.
Then you proceed to edit the record again, turning the record to state B. But this time you mess the form up and decide to Cancel.
When you hit Cancel, the record should revert to state A.
The problem is that this is an unsaved record and thus record.rollback() can not be used.
All i could think of is making a copy of a record and feeding it to the form. But most of the form's fields are bound to related records, thus, you'd have to clone the record's related records recursively. This is a huge hack that i don't want to go for.
Any simpler suggestions?
The approach I have used is based on the buffered proxy pattern within my controllers.
This way your controller can just throw away the buffer on cancel or apply the buffer to models and orchestrate model saves when the user OKs the changes.
Here is an ember package you can use to get started:
https://www.npmjs.com/package/ember-buffered-proxy

Adding items to tableView QT

i need i little help here. I'm creating a application through QtCreator (C++). It's basically a single view application that the user input two line edits, click return than the data from both fields goes to a table view. Here is my problem, i have no idea how to make it work (show the data typed and update the tableView every time the user presses return, i never used tableView before (QT)). I'm not even using database, it's not necessary. And i'm saving the data in a struct.
Any help?
Sorry about my english, thanks in advance!!!!!