Prevent row click event in YUI Datatable - yui

I have a YUI data table. When we click on any row of this data table, there is an alert box.
vtgtTbl.on('rowClickEvent',function(oArgs){
alert("a");
}
I have a checkbox. what i want is that when that checkbox is true then row click will work, and not when it is false. so is there is any method in YUI to attach and detach these events

Within the rowClick event handler callback you can add a check for the checkbox in the following way
vtgtTbl.on('rowClickEvent',function(oArgs){
var checkBoxNode = Y.one('#checkboxId');
if (checkBoxNode.checked) {
alert("a");
}
}
Hope it solves the problem.

Related

compute Visible property for a button, based upon length of a textarea field

I would like to calculate the visibility of a button based upon the content of a text area field (multi line edit box). it should contain at least some text.
I could use the onkeypress event (server) and perform a partial refresh on the button BUT I notice that the partial refresh spinner appears then when users are writing in the field. I would like to avoid this.
What options do I have?
You would be best off writing a client side script for that event. This script should show the button when there are more than 200 characters in the textarea. You will need to set the style visibility to hidden for the button initially. If the form can be edited multiple times, you will need to write this as a function and call it on page load as well as in the keypress event.
If you can use the keyup event instead of keypress, this may be better.
var textareaID = '#{id:textareaID}';
var buttonID = '#{id:buttonID}';
var textareaValue = document.getElementById(textareaID).value;
var visibility;
if (textareaValue.length > 200) {
visibility = 'visible';
}
else
{
visibility = 'hidden';
}
document.getElementById(buttonID).style.visibility=visibility;

How to show/hide an radio button dependant on option set field CRM 2011

I'm newbie on javascript. I'm triying to hide an radio button when a user choose a specific value of the option set. I have wrote this script
function showhideradiobuttom(){
var optValue = Xrm.Page.getAttribute("nav_phone1type").getValue();
if (optValue == 1) {
Xrm.Page.ui.controls.get("nav_phone1spam").setVisible(false);
}
else {
Xrm.Page.ui.controls.get("nav_phone1spam").setVisible(true);}
}
Unfortunatelly this is not working...
Make sure that you are running your javaScript function on the OnChange even of Option Set.

TabBar Segue when selecting row in table view controller

I already have a segue set in place in my table view controller for an add button press. Now I want to have another segue for when the user selects on the newly added object. My code looks like this so far:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:#"Add Vehicle Segue"])
{
NSLog(#"Setting RootViewController as a delegate of AddViewController");
AddViewController *addViewController = segue.destinationViewController;
addViewController.delegate = self;
addViewController.managedObjectContext = self.managedObjectContext;
}
I think I will need to add an else if next to take care of the tab bar segue but don't know how to do that.
Also the tab bar view is just there to show the two tabs so I don't believe I will preform the segue with the reference to core data.
Thanks in advance.!
My storyboard flow
If you do not want to pass value to the next view controller or do any actions that need to done before performing the segue, but just display the tab bar then you don't need to add anything in the prepareForSegue:sender: method. If you do have to do something when performing the segue add and else condition as there is only two segues and write your code inside the else block.

How can I find which column header is selected?

I have a datagrid view in my form and I like to sort the table by clicking the columnheader.
I choose the Columnheader DoubleClick Event for writing the code but I don't know, how I should tell which column header is selected.
Is there any way for it or I have to change my mind?
Look at the DataGridView's ColumnHeaderMouseClick event.
When the event fires you can get the index value of the clicked column through the event's DataGridViewCellMouseEventArgs.ColumnIndex property. The article I linked has an example.
In both ColumnHeaderMouseClick and OnColumnHeaderMouseDoubleClick events you can do:
private void DataGridView1_OnColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
int column = e.ColumnIndex;
}

how to disable click to sort on yui datatable?

I would like to move "click heading to sort" to "double click heading to sort". So currently i'm doing it with the following two lines:
table.unsubscribe("theadCellClickEvent", TAG.content.table.onEventSortColumn);
table.subscribe("theadCellDblclickEvent", TAG.content.table.onEventSortColumn);
However, when i do this, and i click on the heading, it will take me to folder/thead-id (since by default there is a "a" tag wrapped around the heading text.
Any idea how to do it properly?
Thanks a lot!
Jason
You have to stop the default click event. Create a new event handler for the click event that simply stops bubbling the event.
var stopEvent = function(oArgs) {
var evt = oArgs.event;
YAHOO.util.Event.stopEvent(evt);
};
table.unsubscribe("theadCellClickEvent", TAG.content.table.onEventSortColumn);
table.subscribe("theadCellClickEvent", stopEvent);
table.subscribe("theadCellDblclickEvent", TAG.content.table.onEventSortColumn);

Resources