Can I explain in more detail what is the difference between and revealPlace
revealRelativePlace
Just in case the first placeManager.getCurrentPlaceRequest () is cleared , and the second no
http://javadoc.gwt-platform.googlecode.com/hg/0.5/com/gwtplatform/mvp/client/proxy/PlaceManager.html
From the JavaDoc :(http://arcbees.github.io/GWTP/javadoc/apidocs/com/gwtplatform/mvp/client/proxy/PlaceManager.html#revealPlace(com.gwtplatform.mvp.shared.proxy.PlaceRequest) :
void revealRelativePlace(PlaceRequest request)
This discards the current place hierarchy, effectively revealing the request as a top-level place.
To keep the current place hierarchy, see revealRelativePlace(PlaceRequest), revealRelativePlace(PlaceRequest, int) or revealRelativePlace(int).
So, revealRelativePlace essentially keeps the current hierarchy of places, where revealPlace does not.
Related
Using TypeORM, I'm trying to create ViewEntities that depend on each other, for example "View B" select from "View A". No matter what I do I can't get the ViewEntities to get created in the order of dependency. Sometimes "View B" is created first, and the synchronization process fails, because it can't find "View A", since it's not created yet.
The error:
QueryFailedError: relation "public.course_item_view" does not exist
Solutions I have tried:
Renaming the ViewEntity files (to check if the system uses ABC ordering on file names)
Renaming the ViewEntity classes (to check if the system uses ABC ordering on class names)
Renaming the ViewEntity's "name" property (to check if the system uses ABC ordering on the final SQL view names)
Reordering the ViewEntity class references in the "entities: []" array of the connection options
Reordering the ViewEntity class imports in the file where I declare the connection options
Removing/Adding the file again (to check if the system uses Creation Date based ordering)
Modifying the files (to check if the system uses Modification Date based ordering)
All of these failed. I cannot figure out how the system determines the order in which the view's are created.
Any help would be GREATLY appreciated!!
Expected Behavior
The view's should be created in an order that is either specified by a property inside the views, or the order should be resolved automatically from the SELECT statements (dependency array), or it should be based on the order in which I reference the ViewEntities in the "entities: []" array of the connection options, or any other solution would be perfect where one could determine the order in which the ViewEntities are created.
Actual Behavior
The ViewEntites are created in an order that I honestly can't understand. Sometimes a dependent ViewEntity is created before the ViewEntitiy it depends on. This causes the synchronization to fail.
File name: "CourseItemView" which resolves to: "course_item_view"
#ViewEntity({
expression: `
SELECT
"uvcv"."userId",
"uvcv"."courseId",
"uvcv"."videoId",
CAST (null AS integer) AS "examId",
"uvcv"."isComplete" AS "isComplete"
FROM public.video_completed_view AS "uvcv"
UNION ALL
SELECT
"uecv"."userId",
"uecv"."courseId",
CAST (null AS integer) AS "videoId",
"uecv"."examId",
"uecv"."isCompleted" AS "isComplete"
FROM public.user_exam_completed_view AS "uecv"
.
.
File name: "CourseItemStateView" which resolves to: "course_item_state_view"
This DEPENDS on the "course_item_view", as you can see in the SQL
#ViewEntity({
expression: `
SELECT
"course"."id" AS "courseId",
"user"."id" AS "userId",
"civ"."videoId" AS "videoId",
"civ"."isComplete" AS "isVideoCompleted",
"civ"."examId" AS "examId",
"civ"."isComplete" AS "isExamCompleted"
FROM public."course"
LEFT JOIN public."user"
ON 1 = 1
LEFT JOIN public.course_item_view AS "civ" ------------------- HERE
ON "civ"."courseId" = "course"."id"
AND "civ"."userId" = "user"."id"
ORDER BY "civ"."videoId","civ"."examId"
`
})
.
.
My connection options:
const postgresOptions = {
// properties, passwords etc...
entities: [
// entities....
// ...
// ...
// views
VideoCompletedView,
UserExamCompletedView,
UserExamAnswerSessionView,
UserVideoMaxWatchedSecondsView,
CourseItemView, --------------------------------HERE
CourseItemStateView ---------------------------HERE
],
} as ConnectionOptions;
createConnection(postgresOptions )
Steps to Reproduce
Create ViewEntites that depend on each other
You will run into this issue, but is hard to say exactly why and when, this is the main problem.
ClusterGroup clusterGroup = ignite.cluster().forNodeIds(invalidNodeIds)
final Map<IgniteUuid, ComputeTaskFuture<Object>> computeTaskFutures = ignite.compute(clusterGroup).activeTaskFutures();
when fictitious invalidNodeIds are passed in, even though the backing ClusterGroupAdapter has an empty node ids (Set ids) object, I see valid futures being returned. Isn't this wrong ?
Thanks
IgniteCompute.taskFutures() is local operation, i.e. it returns futures for tasks that were executed by the current node. Having said that, cluster group is not applicable to this method.
I recently created a Form Builder form with a repeat to show a list of data. The repeat is working fine. My question is that i need to get the index for the data inside the repeat so that i can use it to get another set of data from tables.
Here is my
<fr:grid columns="2" repeat="true" ref="instance('fr-form-data')/name" id="data-repeat" origin="instance('fr-form-data-template')">
<xh:tr>
<xh:td>
<xf:output id="name-control" ref="person_name">
<xf:label>Name :</xf:label>
</xf:output>
</xh:td>
<xh:td>
<xf:trigger>
<xf:label>Get</xf:label>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="instance('fr-param-instance')/person/mni" value="am_mni"/>
<xf:send submission="get-invl"/>
</xf:action>
</xf:trigger>
</xh:td>
</xh:tr>
</fr:grid>
I need to get the data to put inside here:
<xf:setvalue ref="instance('fr-param-instance')/person/mni" value="am_mni"/>
Thanks
If you have an element am_mni inside the repeat, at the same level of person_name, then your xf:setvalue can look like:
<xf:setvalue ref="instance('fr-param-instance')/person/mni"
value="context()/am_mni"/>
context() refers to the context in which the xf:setvalue runs, which will be the current repeat iteration, since it is inside a repeat. If you just write value="am_mni", this will be evaluated relative to the ref, and thus return instance('fr-param-instance')/person/mni/am_mni, which in your case is most likely an empty sequence.
I am using the SemanticZoom control with a grid view and collection view source. All is working fine until I attempt to select ('jump to') an empty group - this causes an unhandled Catastrophic failure.
http://social.msdn.microsoft.com/Forums/nb-NO/winappswithcsharp/thread/6535656e-3293-4e0d-93b5-453864b95601
Does anybody know if there is a way to fix this - I want to 'allow' an empty group if I can.
Thanks
Okay, so I ran into this issue and fixed it. I know this is quite an old thread, but I'll answer it in case someone else runs into this. Here's how I did it.
The issue seems to be that the group set as the DestinationItem needs to have items in it. In the case that this group is empty, this poses a problem. The problem does not occur when the group is in between other filled groups, because it has a length of 0 and therefore is untargetable. When it is at the end (or possibly the beginning, haven't tried that), this poses an issue because the GridView/ListView targets the last one in the list when the mouse is past the end of the view.
So, how to solve it:
You need to add an event handler for OnViewChangeStarted. In this handler, you will have access to the SemanticZoomViewChangedEventArgs.
The first thing you need to do is find out if the Group being targetted is empty. I am using a custom Group class here, but have cast it to IEnumerable, just because I only need to know how many items are in it. Linq allows me to find the count of the IEnumerable.
using System.Linq;
private void Zoom_OnViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e)
{
var group = e.DestinationItem.Item as IEnumerable;
if (group != null && group.Count() == 0)
{
e.DestinationItem.Item = MyViewModel.Groups.Last(itemGroup => itemGroup.Count() > 0);
}
}
As you'll note, the next step is to set the DestinationItem.Item to the Last group that has items in it. You may also want to handle the First group that has items in it, but that's quite easy to do as well. In place of MyViewModel, insert your ViewModel. In place of Groups, insert your collection property.
I hope this helps and happy coding!
I use jqGrid to display data which is retrieved using NHibernate. jqGrid does paging for me, I just tell NHibernate to get "count" rows starting from "n".
Also, I would like to highlight specific record. For example, in list of employees I'd like a specific employee (id) to be shown and pre-selected in table.
The problem is that this employee may be on non-current page. E.g. I display 20 rows from 0, but "highlighted" employee is #25 and is on second page.
It is possible to pass initial page to jqGrid, so, if I somehow use NHibernate to find what page the "highlighted" employee is on, it will just navigate to that page and then I'll use .setSelection(id) method of jqGrid.
So, the problem is narrowed down to this one: given specific search query like the one below, how do I tell NHibernate to calculate the page where the "highlighted" employee is?
A sample query (simplified):
var query = Session.CreateCriteria<T>();
foreach (var sr in request.SearchFields)
query = query.Add(Expression.Like(sr.Key, "%" + sr.Value + "%"));
query.SetFirstResult((request.Page - 1) * request.Rows)
query.SetMaxResults(request.Rows)
Here, I need to alter (calculate) request.Page so that it points to the page where request.SelectedId is.
Also, one interesting thing is, if sort order is not defined, will I get the same results when I run the search query twice? I'd say that SQL Server may optimize query because order is not defined... in which case I'll only get predictable result if I pull ALL query data once, and then will programmatically in C# slice the specified portion of query results - so that no second query occur. But it will be much slower, of course.
Or, is there another way?
Pretty sure you'd have to figure out the page with another query. This would surely require you to define the column to order by. You'll need to get the order by and restriction working together to count the rows before that particular id. Once you have the number of rows before your id, you can figure what page you need to select and perform the usual paging query.
OK, so currently I do this:
var iquery = GetPagedCriteria<T>(request, true)
.SetProjection(Projections.Property("Id"));
var ids = iquery.List<Guid>();
var index = ids.IndexOf(new Guid(request.SelectedId));
if (index >= 0)
request.Page = index / request.Rows + 1;
and in jqGrid setup options
url: "${Url.Href<MyController>(c => c.JsonIndex(null))}?_SelectedId=${Id}",
// remove _SelectedId from url once loaded because we only need to find its page once
gridComplete: function() {
$("#grid").setGridParam({url: "${Url.Href<MyController>(c => c.JsonIndex(null))}"});
},
loadComplete: function() {
$("#grid").setSelection("${Id}");
}
That is, in request I lookup for index of id and set page if found (jqGrid even understands to display the appropriate page number in the pager because I return the page number to in in json data). In grid setup, I setup url to include the lookup id first, but after grid is loaded I remove it from url so that prev/next buttons work. However I always try to highlight the selected id in the grid.
And of course I always use sorting or the method won't work.
One problem still exists is that I pull all ids from db which is a bit of performance hit. If someone can tell how to find index of the id in the filtered/sorted query I'd accept the answer (since that's the real problem); if no then I'll accept my own answer ;-)
UPDATE: hm, if I sort by id initially I'll be able to use the technique like "SELECT COUNT(*) ... WHERE id < selectedid". This will eliminate the "pull ids" problem... but I'd like to sort by name initially, anyway.
UPDATE: after implemented, I've found a neat side-effect of this technique... when sorting, the active/selected item is preserved ;-) This works if _SelectedId is reset only when page is changed, not when grid is loaded.
UPDATE: here's sources that include the above technique: http://sprokhorenko.blogspot.com/2010/01/jqgrid-mvc-new-version-sources.html