Maui BazorWebView. Information Needed - webview

I currently trying out Maui and would like to keep the Maui Shell and components as the base platform.
But I have found that the CollectionView with about 20 or 30 complex items becomes almost impossible to scroll and gets odd display issues. So I'm currently looking at doing the more complex displays in Razor. I have been using Razor on the web for a while and have had no problems showing many thousands of items. So 50 or 60 complex display items on a mobile phone should not be a problem.
What I would like to do is not host the whole application in the BlazoeWebView, but just call up a single Razor page at a time in the BlazorWebView by either changing the "HostPage" or the "RootComponents".
<BlazorWebView HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
So far I have been unable to find the correct application structure to allow this.
Any information on how to achieve this would be much appreciated.

I figured it out.
Set up an XML namespace with the path to your razor view.
Leave the HostPage at "wwwroot/index.html"
Leave the Selector at Selector="#app"
Set the ContentType to the name of your Razor page.
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:view="**clr-namespace:Your.Path.To.Razor.Page">
<BlazorWebView HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type view:Razor_Page_Name}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentView>

Related

ePub 3-Page Spread

I've been doing a bit of research on the ePub 3 format as I am planning on archiving some older magazine and newspaper scans and want to craft some ePubs as a learning exercise. I also want to understand this stuff in order to help develop a JavaScript ePub reader.
I have a magazine that includes a 3-page poster in it, but I can't get the spine(s) for the poster to render properly.
I've tried using properties on the spines:
<itemref idref="034" properties="rendition:page-spread-center" />
<itemref idref="035" properties="rendition:page-spread-center" />
But, iBooks on OS X and iPad display this as regular pages in-line with the rest of them. For example, pages 34 and 35 should be displayed as individual pages, however they are being rendered with 34 on the right of 33 and 35 on the left of 36.
Am I misunderstanding what the page-spread-* is supposed to do?
I also tried using page-spread-left for both of them, to no avail. Ideally, I'd have the poster broken up into 3 pages (e.g. 034-a, 034-b, 034-c) and have the reader render a 3-page spread (page-spread-left, page-spread-center, page-spread-right), but I don't believe that is how the IDPF spec is defined. That is why I'm trying to figure out how to just display a single spine in the middle of a spread layout. (I've also tried removing the spread meta property depicted below).
Here is some additional information regarding my custom ePub file:
Package (OPF):
<package prefix="rendition: http://www.idpf.org/vocab/rendition/#"
...
<meta property="rendition:layout">pre-paginated</meta>
<meta property="rendition:spread">auto</meta>
com.apple.ibooks.display-options.xml:
<display_options>
<platform name="*">
<option name="fixed-layout">true</option>
</platform>
</display_options>
I am definitely no expert here, only started coding recently.
But I feel like a 3 page spread is unlikely but I have a suggestion:
Use a program, like Photo Standard(dont know if that is a popular one people might know) to cut the middle page of the spread in half
and then add the halves to the the right and the left pages of the spread, respectively to their own place.
So it is like only two pages to the e-reader, but visually it is three.
Maybe it will work, not really sure if that is really related to what you are asking.
Hope it helps.

Automatic lazy-loading in datatable from primefaces

Is there some easy way or maybe a ready component to use lazy-loading in dataTable by Primefaces but without pagination (also not the standard one) ?
I need following feature: when page is loaded dataTable contains only first 10 out of 100 rows (fast response time).
The rest of rows is automatically loaded into the dataTable but user can already work with first portion of data.
Thanks for any advice. In worst case I will have to implement similar behavior by myself, but maybe someone already have some experience.
The feature you're looking for comes very close with "live scrolling". It does load in the background, but only when the bottom is reached in scrolling. See the "DataTable - Scrolling" showcase page.
Here's an extract of relevance from the showcase example, showing the attributes you need:
<p:dataTable var="car" value="#{tableBean.carsLarge}" scrollRows="20"
scrollable="true" liveScroll="true" scrollHeight="150" id="dataTable4">
However, to achieve exactly your functional reqirement, you'd probably need to homebrew or post a new feature request to PrimeFaces guys.

Passing variables from a ribbon button to a modal window via POST in Dynamics CRM 2011

I'm attempting to add a button to the Activities grid ribbon to open a modal window that shows all the activities with latlng data on a map.
I have this working ok for a small number of activities, but once the selected number grows too large CRM has problems opening the modal window.
My current theory is that this is because the parameter string is too long to be passed via the GET method.
Is there a way to pass the SelectedControlSelectedItemIds to the web resource using POST rather than GET? I can't see any in TN docs*, but I'm hoping someone might have found a way.
*http://technet.microsoft.com/en-us/library/gg309332.aspx
Here's a snippet of the code I have at the moment:
<CommandDefinition Id="Mscrm.Isv.activitypointer.HomepageGrid.Group0.Control0">
<EnableRules>
<EnableRule Id="Mscrm.Enabled" />
</EnableRules>
<DisplayRules />
<Actions>
<Url Address="$webresource:as_cam_mapsa" WinMode="1" PassParams="true" WinParams="dialogHeight: 800px; dialogWidth: 1000px">
<CrmParameter Name="data" Value="SelectedControlSelectedItemIds" />
</Url>
</Actions>
</CommandDefinition>
Instead of using a html webresource, you could could call a javascript function with no parameters from the ribbon. Inside this javascript you can use something like this to get the selected ids:
document.getElementById("crmGrid").control.get_selectedIds();
Now you can select if you want to use javascript / jQuery or another framework to build the whole dialog - or you can use showModalDialog in javascript to get the same dialog as crm uses. In any term you now have a litle bit more control on how the parameters are sendt.
You should also be able to use the code above inside your html webresources javascript by getting the parent window from dialogArguments that is sent by default to a modal dialog.
window.dialogArguments.window.document.getElementById("crmGrid").control.get_selectedIds();

ASP.NET MVC: add to querystring on form submit

I'm building a grid in ASP.NET MVC and I have the following issue:
Above the grid i have a column selector which lets people customize the columns being shown. This is a form with a submit button so that people can add/remove multiple columns at once without going trough multiple postbacks.
Below the grid I have paging. This is paging trough actionlinks (a href's).
alt text http://thomasstock.net/mvcget.jpg
What happens when a user add/removes columns is that the form gets submitted to http://localhost:56156/?columnsToDisplay=EmployeeId and ofcourse the grid jumps back to page 1. I'd like to keep the grid on the page the user was currently on. So I need a way to include the current querystring parameters into the form's action attribute.
The other way around too: I need a way to do the same with actionlinks. But this is less necessary as I could always replace the a href's with buttons and put them in a form. But I'd rather not do that.
I'm looking for a solution without javascript! I can do it myself in javascript, but I'd like my grid to work perfectly on javascript-disabled browsers.
Any help is appreciated.
Edit:
Oh yeah, to make it a bit harder, I'm also looking for a solution without cookies/session variables. :-)
You need to add the line below into your column selector form
<input type="hidden" name="page" value="<%=Request.QueryString["page"]%>" />

Rendering complete page and not "progressively" (using struts 2 / tiles)

Is there a way to get struts 2 (using tiles) to build the whole page before sending it to the browser? I don't want the page to be build "progressively" in the browser one part at a time.
The main problem I'm trying to solve is that internet explorer 7 flashes/blinks the page even if only some of the content changes (firefox does this much more smoothly).
So that if I have a page with:
HEADER
some content
FOOTER
And the "some content" area only changes between page loads, the FOOTER part still flashes the white background before filling it with the background color of the footer. I tought that maybe by getting struts to send the complete page it would load fast enough to eliminate the "blinking".
Now the FOOTER comes from the server a little bit later than the parts before it and so it flashes (in internet explorer, firefox displays the page smoothly).
NB: this is an important requirement for the site, and using ajax to load the middle content is out (as are frames or other "hacks"). The site is built using CSS and not a table layout, maybe I will have to use a table layout to get it to work...
About using tiles flush parameter:
I tried that and it doesn't work as I need. I would need a flush-parameter for the whole page. I have tried the normal jsp page directive "autoFlush=false" but it didn't work. I set this directive on my main template page (and not in the tiles).
Here is an example from the main template, which uses header, body and footer templates. With the Thread.sleep() I added the problem is easy to spot. The footer renders 2 secs later than the rest of the page.
<body>
<div id="container">
<t:insertAttribute name="header" flush="false" />
<div id="content"><t:insertAttribute name="body" flush="false"/></div>
<div class="clear"></div>
<% Thread.sleep(2000); %>
<t:insertAttribute name="footer" flush="false" />
</div>
</body>
UPDATE
Thanks for the comments. The requirement is actually almost reasonable as this isn't a normal web page, think embedded.
But apparently there is no way of configuring IE to start rendering after some delay (like firefox has a configurable delay of some 100ms)?
I tried to intercept the TilesResult but the method doExecute is run before the whole content is apparently evaluated, so the method has already exited before the jsp is evaluated (my Thread.sleep() test). I was wondering how I could render the whole response to a string and then output that all at once to the browser.
I know that this isn't foolproof and network delays etc may factor in this, but if I could get the response to output all at once and maybe use a table based layout (IE possibly renders the table only after the table closes) this could work reasonably.
Or then try to get this switched to firefox or maybe forget all about this little glitch...
UPDATE 2
This started to bother me so I did some investigation.
If I had a plain jsp page (no tiles) the buffering works (with the buffer attribute), so that if I had my Thread.sleep() there the whole page rendered after two seconds if the page size was below the buffer size.
But if I used tiles in the page (as in the example above) I couldn't get the page to render at the same time (I even included the page directive in all my tiles-templates/"components", no help). So tiles probably flushes the response somewhere?
Furthermore, the "problematic tiles" was my body-part, which contained a struts:form tag. I replaced it with a normal form-tag and it worked as I wanted...
UPDATE 3
Ok, nobody seems to know the inner workings of tiles or struts tags...
No big problem as this is a very specific case and requirement.
I worked around it by using apache as a proxt in front of the application, and using apache's proxy configuration options to specify a large buffer.
I'll mark this as answered.
You can send page data all at once at the server end if you like (and many frameworks do that anyway for convenience) but the reality of networking is that it won't all arrive at once and the browser will render it as packets arrive. And this is a good thing for responsiveness, even if you* aesthetically would like the page to display all at once.
You can reduce the lag as much as possible by simplifying markup and using deflate compression to keep the payload size down, and that's a worthwhile thing to do in general. Plus you can make sure you're not hitting a Flash Of Unstyled Content. But you can't control when the browser chooses to render, short of doing it all in JavaScript with all the downsides that entails (and even then, the browser might redraw slowly).
(* - or your client/boss, if that's who has come up with this "important requirement" that your site somehow work differently to every other page on the web.)
Can you use the "flush" attribute on the tiles components?
<tiles:insertAttribute name="body" flush="false"/>
In addition if the output buffer gets too big, it will flush anyway. Try increasing the buffer size?
<%# page language="java" buffer="500kb" autoFlush="false" %>

Resources