What I'm trying to achieve is to stop the value change of a radio button set when an option is tapped. If a variable is true when an option is tapped then return false and avoid the visual and value change.
Something like this:
AvoidChange = true;
$(document).on('beforechange','[type=radio]',function(){
if( AvoidChange==true )
return false;
});
I know beforechange can't be applied to radio buttons but... How can this be achieved?
Thanks
Related
I have a grid, with a menu and items.
If I hide all the items using the inbuilt menu, I would like to refresh the pagination so that it display 0-100 items.
The only way I found i looping over all the column, and if all are hidden, then I just hide the pagination, but it's a shitty solution.
http://next.plnkr.co/edit/I3fdjfJDCfoZ8MCH
(hide all the item using the grid menu on the right)
Right now I do this :
let allHidden = true;
lodash.forEach(column.grid.columns, function (col) {
if (col.visible) {
allHidden = false;
return;
}
});
if(allHidden)
$scope.gridOptions1.enablePaginationControls= false;
else
$scope.gridOptions1.enablePaginationControls= true;
but there is still the scrollbar, and actually I don7t like that solution
You could disable both scrollbars, and change the loop a bit.
Still a shitty construction (in your words :), because things will be messy when you decide to unhide any column... You would explicitly have to enable both scollbars again.
gridApi.core.on.columnVisibilityChanged($scope, column => {
if(!column.grid.columns.some(function(col) {return col.visible}))
{
column.grid.options.enablePaginationControls = false;
column.grid.options.enableHorizontalScrollbar = uiGridConstants.scrollbars.NEVER;
column.grid.options.enableVerticalScrollbar = uiGridConstants.scrollbars.NEVER;
}
});
BTW, you would have to inject uiGridConstants to use uiGridConstants.scrollbars.NEVER.
Maybe there is a better solution to your problem, only it is not clear to me what you're trying to achieve here.
I have a button outside the grid, on clicking of this button i am iterating the row nodes and doing a check whether the data is empty or not. If it is empty i want to highlight that row. Did not found anything which can give me any option to highlight the row in ag grid on button click.
Kindly help
I found the answer for above:
In Component: may be in constructor
this.rowClassRules = {
'invalid-row': (params) => {
if (this.inValidRowNode && this.inValidRowNode.data.name === params.data.name) {
return true;
}
}
};
On button click (in validation method), while iterating the node we need to set the data. I am setting in this way.
node.setDataValue('name', ' ');
In Html:
<ag-grid-angular #agGrid rowSelection="multiple" [gridOptions]="gridOptions" [columnDefs]="gridColumnDefs" (gridReady)="onGridReady($event)"
[rowClassRules]="rowClassRules">
I have the hidden property set to YES on two UIViews in viewDidLoad. On a button click, they will be set to NO, therefore they will be shown. How do I make these properties switch between yes/no on every button click?
If the two views are, view1 and view2, you would set up the button to hook to an action such as the following:
-(IBAction)buttonClicked:(id)sender {
view1.hidden = !view1.hidden;
view2.hidden = !view2.hidden;
}
The ! is the logical NOT operator. So it will take the current value for hidden (whether it is true or false) and convert it to the opposite value - so, true if it was false, or false, if it was true.
It should be like this:
-(IBAction)buttonClicked:(id)sender {
drawingView.hidden = !drawingView.isHidden;
}
I have textbox whose visibility is controlled by value selected in telerik dropdown. Say if value selected is yes then textbox is visible else it hides. Now when value in dropdown set to Yes i am not able to set focus to that textbox. Only on pressing 'Tab' key focus moves over there but not as soon as textbox appears. I have tried this code:
function OnDropDownChange(e){
if ($(this).val() === "Y") {
$("#txtID").show();
$("#txtID").focus();
}
}
Any help will be appreciated.
Try this it can be work:
$('#txtID').show('slow', function() {
$(this).focus();
});
Reference
$("#txtID").show(400, function() {
$(this).focus();
});
i've got the following code taken and slightly modified by the original example page:
http://jsfiddle.net/zK3Wc/21/
somehow, if you use the arrow down button to go through the list, it shows the values (digits) in the search field, instead of the label, but the code says, that on the select event, the label should be set as the value.
what i would need is to display the label in the searchfield instead of the digits, but if i click on an item, it has the digit value in the url, the same when using the arrow down button.
Ramo
Add a focus event:
focus: function( event, ui ) {
$( ".project" ).val( ui.item.label );
return false;
},
http://jsfiddle.net/zK3Wc/26/
For me, I forgot to put return false; in the select: callback function