JSF update changed values only - performance

I´ve tried to get some informations about my idea, but still haven´t.
I wan´t to know, if there´s a way to achieve this:
I´m using a primefaces <p:dataTable> to display a list of items. For updating my table if some entries changed, I´m using datatableWidgetVar.filter() within the oncomplete event of <p:ajax>. Because the handled lists are pretty big (~50k-100k entries) it takes a few secs to 'update' the dataTable by its filter method and there is a 'flickering' I´d like to remove...
I don´t want the user to see, that components are reloaded, I mean it should be more 'smooth'. Is there a way to compare those 2 lists and only update the changed rows, so I don´t need to rerender 50,000 items? Or shall I pass the changed items (by id maybe?) to my jsf page and select the rows that are affected? Does primefaces offer such a algorithm?
Thanks in advance, let me know if you need some code or more details ;)
EDIT:
I´ve been thinking about that again and what about:
access the dataTable´s underlying list of items (client-side)
compare the server-side (newer) list with the (older) client-side one
get the changed (modified,added,removed) entries
force my dataTable to update only those 'rows'
Is this a good practise?

Related

Check if Associated View is blank in Dynamic CRM Online

In CRM Online on a customer form is there anyway that you can check if the Associated View for Assets is blank? And if its blank change a field value based on it.
Using JavaScript, 2 ways:
The associated grid is showing records related to your primary record. You can perform the same query the grid is doing using REST which will tell you if there are any records. You can then count the records, and change the field value as required. This approach is better if there are records in the database but which aren't shown in the view for some reason, e.g. view filters.
Access the Grid objects data using getRows(). As above you can then count the records, and change the field value as required. The downside of this is I believe those methods only give you access to the records shown on the form (and not any hidden by filters but still in the database) - but I don't think that that will be a problem here.
Worth bearing in mind that this approach only works client side, e.g. someone has to be actually looking at the form.
If you need to cover the a non-client side approach, e.g. workflows creating records, then you should probably look at plugin development so the changes can be performed server side.
As a side if you just want a simple count shown on form you then you should probably look at Calculated Fields and in particular Rollup fields. You might also be able to run further client side JavaScript from the count.

Default sort for Xpages Dojo Data Grid not working on filtered values

I am trying to implement the DOJO data gird in my application. On load of the xPages I am getting the current user id in a session scope variable and filtering the REST services that supplies the data grid the data from a view, based on the user id. I have used the "keys" property to filter the values so that the current user should be able to see the values only relevant to him in the grid. This is working fine, but when I try to sort the results once the page is loaded it starts displaying blank values and sort does not work. I have made sure that the columns I require to sort are also made sorted for the back-end view by checking the "Click on column header to sort" option in the view. Still I am unable to get the sorting working for columns. Please let me know if there is a work-around for this problem or am I doing or not doing something for the default sort not to work as expected.
Nash, I have had similar issues with the blank rows as you describe. I think the blanks lines are rows that don't match the keys. Here are my tips for fixing this. The issue I think is not with your grid but your Rest service.
Use a viewJsonService type of rest service
Use a category filter instead of keys
Make your category filter code similar to mine below. This will ensure that you don't show documents to someone who shouldn't see them. When the category is null, the Rest service will show all documents. This isn't causing the blank lines, but is a best practice IMO.
var category:String = lineItemBean.getThisUNID();
//wherever your category comes from, maybe session.getUserName() in your case
if(category == null){
return "show nothing"
} else {
return lineItemBean.getThisUNID();
}
I hope this helps. My guess is that this will fix your sorting issues as well.

Oracle ADF: (pre)selection and search in SelectManyCheckbox component

I'm starting with Oracle ADF. I'm trying my first examples with basic components.
Starting from classic HR schema for Oracle ADF (Departments, Employees, Regions, Countries, etc.), I drop a SelectOneChoice for DepartmentsView1, and then I drop a SelectManyCheckbox for related EmployeesView3.
So, the data are well matched and, all employees from selected department are displayed.
Well, my two questions are:
How can I preselect all checkboxes in the SelectManyCheckbox componente? I need that all related employees were preselected.
If I had an input text box, a button and a SelectManyCheckbox component, how can I bind typed value in input box to the query (View Object) and then list the result in the SelectManyCheckbox component?
Maybe they are very basic questions, but I've recently started with Oracle ADF, coming from Java Spring Framwork and I'm changing the problem and programming approach and my mind too.
Any help is very appreciated, because this is a great change for me.
For your first question you've asked, you need to get the binding
(and cast it to JControlListBinding) of the selectManyCheckbox from the bindings
and set its selected values via setSelectedIndices method.
If you want them all to be preselected, you can iterate through all
values, find their indexes, put them in an array and then pass as a
parameter to the setSelectedIndices method.
For the second one,
I have no idea about the reason behind such an operation, but i
guess you could create an appropiate Row with the value the has been
typed in to the box, then you could add it to the RowSet
(via createRow() method of the ViewObjectImpl.) that is bound the selectManyCheckbox.
Maybe because of my rookieness, I don't think that the questions you've asked can considered to be basic. :)
Bonne chance in your ADF adventure by the way.

optimizing ajax based search

I am doing a ajax based search which suggests the values from the database tables as the user inputs fields in the search box. It does work but its really very slow, takes more than 10 seconds minimum for any suggestions to load. how do I optimize this to make it fast..
Like Index it/save it in cache/crawl?
Right now autoSearch() js function is fired which retrieves data from the related table to load the suggestions. how do I make this faster?
I dont know if this will make a difference but I am using grails/groovy for application development.
Thanks
Priyank
Have you added an index to any searched fields (or checked in the database to make sure the examined fields are indexed)?
The Grails GORM does not automatically create indices for text fields unless you add the appropriate static mapping to your domain class.

List of values with multiple return items

List of values, with multiple columns and multiple return values in Apex. It's a question i've seen around the web quite a few times, but i'm struggling with it aswell.
Coming from Oracle Forms, and now migrating forms to Apex, this is a feature i'm missing quite well. It also still baffles me a bit how enormously basic the built-in popup-lov is.
For example, right now i'm making some smaller forms, each having about 4 or 5 multirecord columns, for not much else than having 2 values linked up. Column 1: some value, used in sap for example, column 2: the id of a record in the oracle database (another table than the base table for the block). On column 2 there is an lov, with validate from list, and displays 3 columns, but also returns 3 columns. So you can choose a record from the lov, and automatically, the id will be filled in, aswell as the 'name' and 'description' for said id. Column 1 and column 2 form the base table of the block.
Now, in Apex, i'd loose this functionality by default. So for now, i've mostly coded the onchange event in javascript, and get the values with an ajax callback process. In the popup i concatenate the 3 columns. This however looks stupid (in my most humble opinion) when you want to force the user to pick a value from the lov ('Not Enterable, Show Display Value and Store Return Value'): the item will contain the concatenated value used in the lov, not just the id i'd much rather show - plus, i'll already have my other 2 fields filled in by the ajax callback.
It rather stings a bit to have to deal with this. The users are used to working with these old (headstart generated) forms, with just 2 enterable columns, one of which has an lov. Now they need to start working with this 'new tech', and even though there is some adjustment required, this area does feels a bit archaic at times!
So, i've made it work through an Ajax callback on the onchange event. So, when the value is changed through the lov, extra fields are filled up. This goes together with an after header process, after the automated row fetch, so the values are fetched when the page is loaded (or a user navigates the rows).
I've also written a custom solution, which requires me to create a page with a classic report on it with a search box. I then use this page in an iframe, and pop it up through a modal. When the user selects a record, i return the required returnvalue and a list of displayvalues. This i do through a bunch of javascript, which i've packed in a JS file, and actually requires quite little extra work to do on the pages: include the file on both, make an item with some post element text calling an 'open' procedure, and calling a select-and-close procedure on my lov page. I'm quite considering creating a small item typep plug-in, so i can more easily configure my calling item. Just a couple of buts: i've not actually used this in some forms already, i've engineered this in a testing application after getting frustrated with the standard tool. It would also require the client to maintain this javascript code + remember the config of the 2 items, let alone me writing a small plugin. So i'm hesitant to implement this.
TLDR: if you've been using Apex for a while, and maybe done some forms: how do you actually work with the popups. And if you've known forms: how did you deal with this change?
I'm still struggling - throw me a bone ;)
I haven't used it myself yet but I believe SkillBuilders Super LOV plug-in probably does what you need.

Resources