CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

New features in 1.7-2.1, some questions.

General discussion

by Jorge Sousa » 27 Nov 2013 15:15

ok, can you join cgdevtools @ skype?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 28 Nov 2013 09:01

Hi!
I forgot to describe this code:
delphi code
wAjaxBrowserHistory.AddHash('frame1');
// would be useful to be able to write "wAjaxBrowserHistory.AddHash('frame1', False {disable ajax response to IWCGJQAjaxBrowserHistory1HashChange event}")
// and write required code here:
// CreateFrame(TIWCGJQFrame1); // instead of writing it in "IWCGJQAjaxBrowserHistory1HashChange"

This implementation gives more control, because if user presses button twice with same "wAjaxBrowserHistory.AddHash('frame1')" code,
second time, event "IWCGJQAjaxBrowserHistory1HashChange" will not trigger and my button click handler inside "IWCGJQAjaxBrowserHistory1HashChange" will not be called.
And one more thing: this code will open frame faster, because app will not wait response from client.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 28 Nov 2013 11:32

Hi George

We understand what you mean, but unfortunatelly that event is called by the browser itself when the url changes whether is by user interatction or programatically.

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

by George » 28 Nov 2013 13:25

that event is called by the browser itself when the url changes

Browser do it without javascript code from main index.js?
If your JS called to sent ajax response, maybe possible to add IDs on every ajaxhistory.AddHash('anyhash', true) event.
How i see possible solution (if browser use your javascript code) -
When ajaxhistory.AddHash executed, on server side we cat create new guid,
with ajax response we can send this guid to browser, that guid can be assigned to some variable on client side,
when url changed and browser send response, maybe we can add this guid to response?
Then on server side we simply can compare response guid with ignore list. If received id match with some item from ignore list, we can skip form refreshing (same time we should delete this id from server ignore list).
Ignore list can be simple private tstringlist property in ajaxhistory component.

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

by Jorge Sousa » 28 Nov 2013 18:41

Hi

Browser do it without javascript code from main index.js?


Yes, it's the event

window.onhashchange

https://developer.mozilla.org/en-US/docs/Web/API/Window.onhashchange

About the rest, you could do easily using your own code in the server with only a Boolean property in the form, indicating if it's first hash.

We don't tend to do much on server, besides rendering the most directly possible. The viability and future of this project depends on this.

we think Intraweb web app developers should have the same skills of html and script, needed by any other web framework, and not depend so much on translation.

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

by George » 12 Feb 2014 08:38

How to remove hash from url via AjaxBrowserHistory or how to set empty hash?
When i'm on some page, for example: http://app/#TestFrame, and i press button GoBack, in some cases, i need to clear hash or set empty hash.
wAjaxBrowserHistory.AddHash('') not work...
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 12 Feb 2014 17:06

Hi George

That's a very interesting question

You can use the following code

var
js: string;
begin
js:= 'window.location.href = "";';
CGAddJavaScriptToAjaxResponse(js);
end;

PS: If it works, please let us know, so we can implement a new method: DeleteHash
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 12 Feb 2014 20:21

I tried this code:
delphi code
CGAddJavaScriptToAjaxResponse('window.location.hash = "";');

(window.location.hash instead of window.location.href)
Result: http://app/# that's good

PS: If it works, please let us know, so we can implement a new method: DeleteHash

Why not just call this code on "AjaxBrowserHistory.AddHash('')?

And what is purpose of AjaxBrowserHistory.Hash property?
FHash: string; never used :)
As i can imagine, it may show last hash value from AjaxBrowserHistory.
Then, AddHash should write value to FHash. :?
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 12 Feb 2014 21:59

Hi George

Thanks for your feedback

About

Why not just call this code on "AjaxBrowserHistory.AddHash('')?


The AddHash calls window.location.href, now that i read you, i think it should call .hash instead, we need to conduct some tests.

I was hoping that

window.location.href = "";

could remove the hash completely, even the #

And what is purpose of AjaxBrowserHistory.Hash property?


This is to define an initial hash.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 13 Feb 2014 13:29

Hi!
remove the hash completely, even the #

# on the end is not problem, # = empty hash.

But, window.location.href or window.location.hash, i don't know what is better..

Why window.location.href = '' not deletes all url?
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

PreviousNext

Return to General - Archive

Who is online

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

Contact Us.