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

[Solved] when I change an href with jquery the controller uses old value

0 Answers 23 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
A
Top achievements
Rank 1
A asked on 14 Sep 2011, 10:39 AM
Hi,

On my page I have a grid and a tabstrip. When clicking on a row the location value for the tabstripitems needs to change. I have done this with Jquery, but when I select the tab using the javascript API the controller still uses the old value that was originally on the page. My guess is there is some form of caching going on. How can I turn this off?

Here some pseudo code:

View:
Render grid
Render tabstrip

Here's my javascript
function onRowSelectedTabbed(e) {
    var targetID = e.target.id;
    var row = e.row;
    var selectedID = $(row).attr("id");
  
    var $items = $('.t-tabstrip-items li a');
  
    for (i = 0; i < $items.length; i++) {
        var $item = $items[i];
        var href = $item.href;
        href = href.replace(/clid=([^&]*)/, 'clid=' + selectedID);
        href = href.replace(/gridName=([^&]*)/, 'gridName=' + targetID);
        $item.href = href;
    }
  
    Select();
  
}
  
function Select() {
  
    var tabstrip = getTabStrip();
    var $items = $("li", tabstrip.element);
    var item = $items[0];
    tabstrip.select(item);
}
  
  
function getTabStrip() {
    //"TabStrip" is the value specified by the Name() method.
    var menu = $("#DetailsHolder").data("tTabStrip");
    return menu;
}

Now when the tab is reloading in the tabstrip.select(item), the controller get the old value passed. When debugging the element innerHTML has the new value, but the contentURLS are still referring to the old location and this is the value the controller gets.

What is wrong?
Tags
TabStrip
Asked by
A
Top achievements
Rank 1
Share this question
or