JHipster ComboBox lazyloading - jhipster

I'm starter to use JHipster. One of my entity A has more than 3000 data. So I used infinite-scroll as pagination. But as relation to another Entry B, it will be generated as a comboBox in the dialog. I got only 20 data in the comboBox. There is no infinit-scroll or search and loading to get more data.
Can someone give any advice to fix the problem?

The infinite scroll uses pages (which is mapped to pageablea in spring). Thus, your service call that fetches the data for the box only fetches the first page. And the default page size is 20. So, you need to increase the page size to get more results.
You can either overwrite the "size" variable or the global constant called "itemsPerPage" which is located in pagination.constants.js
Am I right that it is a one-to-many relationshiop and you want to choose one of 3000 possible A for an entity B?
If so, you don't want to load all 3000 possible As into the dropdown. Therefore, I would replace the dropdown with another input, e.g. the typeahead from angular-ui (https://angular-ui.github.io/bootstrap/#/typeahead), so you can fetch a filtered subset of your entities.
Another way, I also used before, would be a list with a pagination for A that opens in a modal and returns the selected entity that could be passed to b.
Or, if you really want to fetch all: I would add a new endpoint without the pageable, add a new method to the angular-resource-service and call this instead of the paged version.

Related

xPath Namemapping for several dropdowns

I have a button that is dynamic in several webscreens using TestComplete.
I have a buttonKeep object that is successfully implemented in the first screen it goes through the first screen and selects a Word and Excel document copies data up and then I paste it to the website
//div[(contains(#style,'display: block'))]//button[#id='Keep']
OR //div[not(contains(#style,"display:none'))]//button[contains(#class, 'fr-keep-word')]
OR //button[contains(#class, 'fr-keep-word')]
OR //div[2]/div/div/button[2]
OR //div[contains(#style,'display: block')]
Now I will select a screen that will move me on to a series of dropdowns where I will do the same thing in one of the drop downs. The system wants to add a different buttonKeep object everytime I run the test rather than recognized that the item had been mapped correctly earlier. Or even when I selected the first time I run the test.
Any suggestions would be very helpful.
I imagine this issue is due to a dynamic element in the page object. With the page objects being different, that cause the same object to be mapped again.
I would recommend investigating the page objects, and if they are the same page, but with a dynamic section, add wildcard values to account for the dynamic nodes.
To make mapping settings independent of dynamic changes in web page URLs, you can use the asterisk () wildcard in place of the values -- http://www.example.com/index.asp?act=12312&sid=, or in place of the entire query string -- http://www.example.com/index.asp.

why are field values being erased with an xPage full update (on another field)?

I have an xPage that is behaving very oddly. (if xPages get corrupt, I think this one might be) Tell me what you think:
I have editable fields with onChange events that take the value of the field (a company name) and looks into the database to see if the company already exists. If it does not, a field called "isNew" is set to "y". BUT the next time a Full Update is performed, from another field or button, my "isNew" field (or all of them) are erased! Why on earth would a full update erase a totally different field?
Do I need to just recreate this xPage?
============================================================================
Ok, here's the onChange event on the editable field that sets the flag:
var c = currentDocument.getItemValueString("company");
var id = #DbLookup("","AD",tc,11); // this view column gets the doc ID
if (id==null || id==""){
#SetField("isNew","y")
}
This field is being set properly - I use a computed field to display it. But the next full update (button, field, whatever) will erase the "isNew" field.
I think your problem is caused by the data sources you have on your page and how you save them.
Maybe you have data sources that gets binded from the url that should not be.
Are you using data sources within a repeat or view panel? If so, make sure you are only saving the correct data source
JSF (and thus XPages) works best when keeping MVC in mind. So you never manipulate a component, but keep that component bound to a model, like a data source or a scope. This way code doesn't get into each other's way.
A refresh of a page computes the whole tree, not just the updated field, so you need to design your calls carefully.
Work directly with your data source so do this instead of #SetField():
currentDocument.setValue("isNew", "y")

Xpages: Code a new page button so that I can repopulate some fields in new Xpage

This seems like it should be easy to do but I cannot get it done.
I have an Xpage called Location. There are two general types, A and B. I have a series of views for A and B. They are the same except for the value of that one field.
In the views I want my "New Location" button to automatically populate the type to A or B, depending on whether the user is in one of the A views or B views.
Seems like I would set a scoped variable and then check for that on document creation, but it doesn't seem to work. What is the best practice to do this?
Jesse Gallagher's frostillicus framework on OpenNTF (XPages Scaffolding - http://openntf.org/main.nsf/project.xsp?r=project/XPages%20Scaffolding&SessionID=DN6QBBFGEB) includes flashScopes, which give the facility to pass information from one page to another and get cleared when the page is loaded.
You can use sessionScope variable to transfer data from one XPage to another.
A better approach might be to use URL parameter for your case.
Add for example &type=A to your URL like
http://server/database.nsf/Location.xsp?action=newDocument&type=A
Then you can read this parameter in your destination XPage with param.type like
var type = param.type;
The disadvantage of sessionScope is that it's the same for all browser tabs. So, you need to delete it right after usage in this case. Using an URL parameter instead you don't have to think about that.

Change the site look based on user's list item property

We have a list containing the ADUsername and Boolean field (Yes/No) columns. Based on the logged in user we are fetching this list item and corresponding value for yes/no field.
Now we want to change the look of the SharePoint site based on this value.
Yes=Blue suitebar and top bar.
No=Green suitebar and top bar.
Possible solutions we have envisioned:
Composed looks (we have worked on this but not sure if they can be changed on run time)
Master page (creating master page with hardcoded blue/green color, but not sure if it is possible to call master page at runtime)
I believe both above methods will fail as there will be multiple users accessing the site at same time and changing the master page/composed look at run time is not feasible.
The 3rd method we were thinking of is to use Javascript on the Master Page using client object model to detect the list item (yes/no) value and change the CSS colors/file dynamically.
Let me know your views on this approach or other possible solution. Thanks.

update netsuite parent field via suitescript in view mode

I have scripts that react off of, for example, a client Recalc client event. For example, on my form I have a subtab that users may add or remove items from. Based on actions on this subtab (housing a child record of the parent) I would like a field on the parent to update (say to show a total from the children records).
As I was saying, these events seem to work fine if in edit mode but they do not work correctly in view mode. (even in view mode these child records have a "Delete" option at the end of each row in the subtab. This was provided by netsuite by default.
I wondered if anyone had any tips to best allow this parent field to update real time while in updating the subtab rows with the form in view mode.
Thanks.
You can make a custom field on the parent (header) whose value is determined by saved search. For instance, make a saved search that totals the line values by transaction. Be sure to make it filter by transaction in the Available Filters tab. Make the search public so everyone can use it.
Create the custom field that sources the total from the saved search. Make sure to uncheck the "Store Value" checkbox, as you don't want to store the data, you want to reference the search results. You do this on the Validation and Defaulting tab. You'll see a field for Saved Search there. Choose the search you created above.
As you remove/add/change lines on the transaction, the field updates accordingly. In essence, you don't need a single line of code to make this work - it's all in how you create the search and the custom field that references it.
I have a similar situation posted here.
The NetSuite team answered me by email, and it happens you can't really achieve this on the view mode: some API methods are not available. Their suggestion to my case (and I think it applies to yours too) was really to force a refresh on the whole page.
Of course, you can always achieve this accessing the DOM elements directly, but this isn't a best practice, as your code can stop working if these elements change on a version update.
I had the same problem, I'm not able to restrict on view or remove edit button. But, there was one alternative solution with workflows, you can deploy workflow on child record edit mode restrictions, then if the user clicks edit on view then the record will not be available to edit. This concern will apply to custom record as well.

Resources