This project is read-only.

mdo:ajax, mdo:navigate and iFinity FriendlyUrl

Developer
Aug 9, 2010 at 2:33 PM
Edited Aug 9, 2010 at 2:34 PM
Anton, I'm getting a strange behaviour using both mdo:ajax and mdo:navigate on the same form.
I use mdo:ajax to set values to my parameters, for example:

<select onchange="{mdo:ajax('$idDist', '@this.value')}">
With this I set the value of my $idDist param, which I later pass to my navigate function this way:

a href="{mdo:navigate('$idDist', mdo:param('$idDist'), '$go', '1') }">CALCULATE

The strange thing is that if I click on the "CALCULATE" href before any ajax call, all works perfectly; but if I change some parameter by mdo:ajax before clicking the href, the mdo:navigate function looses my complete path. For example:

Page containing my xsltdb module: http://dnnportal/Amministrazione/Reportistica/Fatturato

As soon as I open the page, the "calculate" link above becomes: http://dnnportal/Amministrazione/Reportistica/Fatturato?TabId=124&idDist=&go=1

But if I change value in the select (mdo:ajax), it becomes: http://dnnportal/?TabId=124&idDist=103&go=1

So that when I click the href I'm sent to the homepage, and cannot see my report.
Could this be due to iFinity FriendlyUrl provider? If I print mdo:request('url') I always see just "/Default.aspx", which is stripped off by FriendlyUrl (configured not to use page extensions). Maybe calling DotNetNuke.Services.Url.FriendlyUrl.FriendlyUrlProvider.Instance().FriendlyUrl() instead of NavigateURL() could solve?
Developer
Aug 9, 2010 at 3:54 PM
More on this: I also get strange results running the sample you gave me in this thread: if I enable the checkbox I get a redirect, but to the wrong page!
Investigating...
Developer
Aug 9, 2010 at 4:08 PM
Tried to disable iFinity FriendlyURL provider, but still have the problem: it appears paths are truncated.
But I found you can see the same problem at http://xsltdb.com/trapias.aspx: if you enable the checkbox you get redirected to portal homepage, instead of the same page. Is this a bug, or I'm just missing something?
Coordinator
Aug 9, 2010 at 4:18 PM

Thank you for detailed explanations. I'll try to reproduce and fix it ASAP.

Coordinator
Aug 10, 2010 at 7:10 AM

New release 01.01.54 fixes mdo:navigate.

But there are some exceptions. If there is a module on the page that generates links to the same page you can loose values of parameters if mixing mdo:ajax and mdo:navigate. For example when switching language by clicking on flag, DNN generates a URL that does not use current value of parameter set by mdo:ajax. I have to make some research to discover the best integration aproach for URLs. But I don't use mdo:navigate in my projects therefore it can take a significant period of time.

http://xsltdb.com/trapias.aspx is not about this bug as it does not use mdo:navigate. It redirects to a URL typed in a textbox and uses server-side redirection via mdo:redirect.

Developer
Aug 10, 2010 at 9:44 AM
Anton,
I'm testing 1.1.54, but it's not working: after any call to mdo:ajax, my mdo:navigate now points to ajax.aspx. For example:

http://dnnhost/Amministrazione/Reportistica/Fatturato?idDist=104&go=1

becomes

http://dnnhost/DesktopModules/XsltDb/ajax.aspx?idDist=103&go=1

Doing some tests, I also notice my ajax calls become very slow if I have some data loaded within the module: I built a form to show some statistics on orders, and if I try to change a parameter (for example the select for idDist, see above) after having run the report once, it is very slow to complete ajax callback. It appears that all the module is reloaded: hard to tell how, but maybe an updatepanel could help?

At first page load, the module now also shows an "Execution time": nice for debugging, but it would be better to be able to choose whether to see it or not (or to show to administrators/host users only).

As for the sample at http://xsltdb.com/trapias.aspx, my fault: I was not typing in the textbox! ;-)

Developer
Aug 10, 2010 at 10:30 AM
Further tests: I now avoid using mdo:navigate, got mdo:jsubmit instead (like in your sample) and it works perfectly. I also changed the way parameters are set, switching from:

select onchange="{mdo:ajax('$idDist', '@this.value')}" to select name="idDist" onchange="{mdo:ajax()}"

It all seems more fluent now, loading time are better for ajax calls - data is deleted when I change a parameter value, and reloaded only when I submit the form.
Die, navigate, die! :-D

PS: execution time IS actually shown only to administrators, my fault again!
Coordinator
Aug 10, 2010 at 11:00 AM

Alberto,

1. mdo:navigate fix was made in xsltdb.js file, and your situation looks like unsing old version of this file from browser's cache. Just Ftrl-F5 it.
2. I develop mdo:navigate to use it for search engines. if I detect search engine bot I render navigation for paging otherwise i render ajax.
3. "Execution time" is left occasionally, but for SuperUsers only. I will remove it next release.

Actually, using submit/ajax techniqus is more user friendly. AJAX is very fast, so I advice you to develop using AJAX/submit.

Also you can try desktop-like development without repaint whole module (as mdo:ajax does) but using <mdo:callable> to create javascript function that do work on server and get back result that you process in javascript and update controls and content with jQuery. This also solves controls state problem.

Developer
Aug 10, 2010 at 11:36 AM
Anton,
thanks so much: will sure try mdo:callable also. I really love this module, jQuery + XsltDB give both power and fast development !

Having execution time I think can be useful, I'd keep it.