I have loaded all jquery tabs content using
$("#featured").tabs( 'load' , modul) inside a loop so that it loads 'n' number of tabs
but all tab containers were disabled . how select at least one tab.
Look at this working example: http://jsfiddle.net/n4mqC/
You can try:
$("#featured").tabs('select', 1);
Related
Scroll to element works fine if element is lower position ( scroll down ) , but in case of element is upper position ( scroll up ) it don't scroll to element in view rather it scroll one less to element ( count is not fixed may it 2 or 3 , varies ) .
I have to write explicit code for scroll up for element which is up , after ScrollIntoView , this is not consistent as scroll up count is not fixed .
I used this 2 codes one by one , but both gives same behavior
Code1 :
// Scroll to view by Action
Actions actions = new Actions(driver);
actions.MoveToElement(webElement);
actions.Perform();
Code 2:
// Scroll to view by JavaScript executer
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", webElement);
Please help me in this case , please suggest what I have to with this .
Referrence: scrollIntoView vs moveToElement You have more control on how the element is scrolled with scrollIntoView than with moveToElement. Selenium is only interested in bringing the element into view so that the mouse can be placed on it. It does not give you any say in how it is going to do it. scrollIntoView however allows you, for instance, to specify whether you want the top or bottom of the element to be align with its scrollable ancestor. Check this for more details: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
You can try double MoveToElement(). First scroll to the element parent and than to the element itself
actions.MoveToElement(parentElement).MoveToElement(webElement).Perform();
Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode
How can I manipulate DOM on page 2 (e.g. TD) when you are in page 1 of Datatables?
Using this code isn't possible because TD of another page is not on DOM until you select page 2.
$("td").html("some code here..");
When using jQuery DataTables, you cannot access the DOM on a different screen, because DOM elements exist on the current screen only.
Instead, you can access or change the DataTable's internal value of a table cell's contents by using the cell().data() function:
myDataTable.cell(row,column).data('some code here ...');
Example Fiddle
Can I add an item to the container as the first one rather than appending all existing ones.
From what I understand this.add([item]) will add item as the last one, however I would like it to apper it on the top of the screen before anything else has been added.
You can use insert method of container like this:
this.insert(0 , item);
where it would appear depends on your layout.
I am encountering a problem of jquery live function not consistently working for me (or that what I think).
I have the same html form which is used for both adding new comment and editing an existing one; this form is propagated using a php code at the server side through a GET call. The two forms are displayed in two different tabs (tab1: adding a comment, tab2: listing the comments; tab3: edit a comment selected in tab2) based on the tab selection. The "Add comment" form appears as the main content of the tab1; however, the 'edit' form appears based on the selection of the comment that needs to be edit in tab2, so let assume that the "edit comment" form appears as tab3. The below code work perfectly for tab1 when the form is the main content of that tab; but it doesn't work consistently when it is the main content of tab3, which is showed based on which comment need to be edit in tab2.
$("input.sample_radio").live('change',function(){
if ($(this).val() == 'no')
$('#sample_table').hide();
else if ($(this).val() == 'yes')
$('#sample_table').show();
return false;
});
If you can provide me with some thoughts, it would be appreciated. My observations were:
I used $("input[name='sample_radio']") but this didn't work for the form of tab3 because it always end up at the form of tab1
by using $("input.sample_radio") I assumed all the classes of type 'sample_radio' would work, but it not working either.
live is supposed to bind events to the new elements added to the DOM tree after jquery calls, but it seems this is not the case for me.
Thanks
Following the suggestion of Mark Schultheiss
Look into .delegate() which was presented specifically to address this by allowing you to specify a context.
I managed to solve this issue by binding the event to the selected parents (tab1 and tab3) of the radio buttons and then filtering based on the selector which is here is the name of the radio button element and as shown below:
$('#tab1,#tab3').delegate('input[name="policy_radio"]','change',function(){
if ($(this).val() == 'no')
$('.policy_table').hide();
else if ($(this).val() == 'yes')
$('.policy_table').show();
return false;
});
Thanks for pointing me to this point.
By using .live you have ran into one of it's challenges. When you change the selection context you prevent it from working properly.
Look into .delegate() which was presented specifically to address this by allowing you to specify a context.
See this post for some notes on delegate from Brandon Aaron: http://brandonaaron.net/blog/2010/03/4/event-delegation-with-jquery
And see this nice one on context: http://brandonaaron.net/blog/2009/06/24/understanding-the-context-in-jquery