CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

New features in 1.7-2.1, some questions.

General discussion

by Jorge Sousa » 14 Feb 2014 19:18

Hi George

We just sent you a new unit, that uses location.hash instead of location.href

the hability of calling AddHash('') which is does the same as the new method .DeleteHash

Since you're using this component extensively, we would appreciate your feedback.

Thanks in advance
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 17 Feb 2014 13:45

Hi!

I was tested new module.
Delete hash works good!

Also i found strange behavior:
When session created, be sure that you see url "http://127.0.0.1:8888/$/".
Next, close browser, but don't terminate IW server.
Then, open browser with empty tab and input that url: http://127.0.0.1:8888/$/#test
On hash change will not be called. Demo.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 17 Feb 2014 15:13

js:= '$(window).trigger("hashchange");';
Maybe "PageContext.AddToOnReady(js);" better to be replaced with "PageContext.AddToInitProc()"?

With this code:
Code: Select all
procedure TIWMainForm.IWAppFormRender(Sender: TObject);
begin
  PageContext.AddToInitProc('$(window).trigger("hashchange");');
end;


Event called even if tab is duplicated.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 17 Feb 2014 15:16

George

You don't have to execute that code on your side, because its already called internally
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 17 Feb 2014 15:26

I'm not calling this code: PageContext.AddToOnReady(js); I'm just testing.
Here html sample, if you try to duplicate tab, event will be called each time.

With current internal code, ajaxbrowserhistory.onchange not called when page duplicated (or url with hash inserted in new empty tab).
Here a detailed (and updated) sample.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 19 Feb 2014 14:04

:)
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 19 Feb 2014 16:09

Hi George

Yes we do agree that you must call PageContext.AddToInitProc instead o .AddToOnReady

And we were wrong, when we said that this is done automatically, it's only have if AjaxPageHistory.Hash <> '' or when you can call AjaxPageHistory.AddHash .DeleteHash in OnRender or OnCreate
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 19 Feb 2014 16:44

When PageContext.AddToInitProc is implemented, in some cases i get double "hashchange" event.
I'll provide more info later.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 24 Feb 2014 08:31

Hi!
I've some new info:

1.
Would be useful if wAjaxBrowserHistory will get method "ClearHashHistory".

2.
I think, this JS code will better work in AddHash method:
delphi code
procedure TIWCGJQCustomAjaxBrowserHistory.AddHash(const AHash: string);
var
js: string;
begin
//...
//js:= Format('window.location.hash = "%s";',[js]);
js := Format('if (window.location.hash != "#%s") {window.location.hash = "%s";} else {$(window).trigger("hashchange");}',[js,js]);
//...
end;
With this code i can be sure, that wAjaxBrowserHistory.AddHash will be processed as expected.
With default code, sometimes i got that wAjaxBrowserHistory.AddHash does nothing, when url hash and new hash are the same.
For example, when user not authorized, i don't open requested frame, but url contains hash. Then, when user log in, wAjaxBrowserHistory.AddHash does nothing.

George wrote:When PageContext.AddToInitProc is implemented, in some cases i get double "hashchange" event.
I'll provide more info later.
in process.. so far all ok.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 24 Feb 2014 10:52

Hi George

About 1, ok.

About 2, please revise this

Code: Select all
js := Format('if (window.location.hash != "#%s") {window.location.hash = "%s";} else {$(window).trigger("hashchange");}',[js,js]);


the value of js for

[js,js]

is empty
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

PreviousNext

Return to General - Archive

Who is online

Users browsing this forum: Google [Bot] and 5 guests

Contact Us.