This is a migrated thread and some comments may be shown as answers.

Grid Custom Command and Hash (#) in Url for Single-Page-Applications

1 Answer 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christophla
Top achievements
Rank 1
Christophla asked on 05 Nov 2012, 06:39 PM
I have a single-page-application that uses url hashes to set state for the UI. When generating a grid custom command, the button link is generated as <a href="#"></a>. This causes the hash monitor (jquery-bbq) to load an unintended statefor the UI.

Is it possible to either a) remove the hash from the link or b) set the link to the current hash?

i.e. <a href="#nav=admin&sub=1"></a> where 'nav=admin&sub=1' is already set for the current page state url hash.

TIA

1 Answer, 1 is accepted

Sort by
0
Christophla
Top achievements
Rank 1
answered on 05 Nov 2012, 06:52 PM
I ended up doing a jquery hack to set the hash:

$('a.k-grid-view').attr('href', window.location.hash);

with '-view' being the name of the custom grid command.

It would be nice, though, if the grid did this when generating the anchor, versus having to do a post-scan of the entire DOM for matches.
Tags
Grid
Asked by
Christophla
Top achievements
Rank 1
Answers by
Christophla
Top achievements
Rank 1
Share this question
or