How To hide FooTable Columns Dynamically? - footable

I have tried this code but it works for once but not every time.
$('.rptEmail').attr('data-ignore','true');
$('.rptEmail').attr('data-hide','all');
$('#ReportMainGrid').trigger('footable_redraw');
I have tried other trigger also but nothing works properly.

I'm surprised no one else has had this problem. After pecking around the code, it looks like the data attributes for the rows are pulled using the .data() jquery function. The problem with this is (from what I understand) the function will populate on initial page load. What this means is, even though you change the data-hide attribute with .attr(), .data() will still hold the old value.
To get around this, without touching the Footable code, you can simply use the .data() function to change the column's property.
$("PATH_TO_TH").data("hide", "all"); //Set this to whatever you'd like
$('.footable').data('footable').reset();
$('.footable').footable();

If you want to use FooTable functions you can do this:
FooTable.get('#FooTable_ID').columns.get(col_id).visible = false;
FooTable.get('#FooTable_ID').draw();
where col_id is the index of the column you want to work with.

Sorry to jump in on this very old question but a much simpler method is to call .toggle or .hide/.show via jquery:
$('table td:nth-child(1),th:nth-child(1)').hide();
The above code will hide the header and the associated column rows.

Related

Modify an ag-grid row after rendering

I need to slightly modify a ag-grid row after it has been rendered. In ag-grid, the actual HTML elements are not necessarily persistent, so manually-set styles may fall off.
For one thing, I have to modify the selection checkbox to set its tabindex to -1. This can technically be done in the cellRenderer callback, although it looks quite hacky. (The checkbox can be found at params.eGridCell.children[0].children[0].wrappedElement.)
But I also have to add a CSS class to some rows to highlight them based on external criteria. I haven't found a way to do this at all.
The best solution would seem to be using some sort of after-rendering callback, but to my knowledge no such thing exists.
I found a couple of related questions, but they were both resolved via cellStyle, which would not suffice here:
Row formatting in ag-Grid
How to provide a background color for an entire row in ag grid based on a certain value in a column?
You have not 1 but 3 options:
getRowClass(params):
Callback version of property 'rowClass'. Function should return a string or an array of strings.
getRowStyle(params):
Callback version of property 'rowStyle'. Function should return an object of CSS values.
processRowPostCreate(params):
Allows you to process rows after they are created. So do final adding of custom attributes etc.
In this last one you have the row in params.eRow.
All taken from https://www.ag-grid.com/javascript-grid-callbacks/index.php

dc.js chart.select function

I am new to dc.js. And I refer to the API Reference and see the chart.select function. But I do not know how to use it.
Such as I have a piechart and I want to have the value and percentage showing in the div below the chart. Could some one tell me if this can be realized using chart.select?
chart.select is for selecting some elements in the d3 or CSS selector sense, if you want to apply some attributes. It probably won't help you directly.
What you are probably looking for is the filtered event, which will tell you when items have been selected. Then you can read the filters and display them elsewhere like so:
chart.on('filtered.some_id', function() {
d3.select('#your-div').text(chart.filters().join(','));
});
(There are also ways to respond directly to interaction events, but I think this is more to the point for what you're trying to do.)

GXT 3 spinnerField validation

I want to validate that user cannot change spinner value manually by typing in text box of spinner.
For example a field sales multiple = x which I fetched from server not fix.
and displays a spinner field with limitation of like bellow
spinner.setMinValue = x
spinner.setIncrement = x
spinner.setValue = x
so user forcefully select a value which is multiple with x. e.g. if x=3 the user have to enter 3,6,9... and so on.
So here my issue is if I type a 2 in spinner field text box. GXT widget accept that value.
Posible solutions:
Is there any predefined properties of spinnerfield that i forget to set it?
Is there any predefined validator for this?
Can I set text box of spinner field read only by css so user cannot focus on text box but still change a value.
If none of above how to achieve manually?
i've searched a bit in the different classes and I don't see either a precise method which would set what you want.
Don't know about one, and even with one, a validator doesn't change the value in the input field, but maybe it's enough for your needs.
You can disable the text input by calling setEditable(boolean) on the spinnerfield (testSpinner.setEditable(false);)
Maybe you could search around the IntegerPropertyEditor, I haven't tried but as long as a new Spinner is like this:
SpinnerField<Integer> testSpinner = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
you can seen that there is another Constructor for IntegerPropertyEditor, which takes a "NumberFormat" param, but there is no NumberFormart() constructor, so I'm not sure about how you create your own one, but that could be an idea (to format numbers in the input to be a multiple of the increment).
The last option would be that Sencha forgot this possibility and that you should report this as a "bug" on the forum ?
Hope to have helped a bit, good luck :).

How to dynamically insert and remove rows

I'm looking for a widget which can be dynamically resized. I need to append and remove rows.
There are a methods coming with Grid, like gtk_grid_insert_row or gtk_grid_insert_next_to, but I don't find any xxx_remove_xxx method.
I'm developing a simple http client (to test an api). And I'm adding the possibility to append and remove "GET" variables dynamically.
The UI is made with rows containing a combobox (for variable selection), an entry (for its value) and on the last row a remove button.
Every time I set a variable, a new line (new available variable) is appended.
And every time I unset a variable, the corresponding line is removed.
thanks.
Gtk.Grid doesn't have a remove method; but Gtk.Container does. Since Grid is a Container, you can use gtk_container_remove.
The docs for this are here:
https://developer.gnome.org/gtk3/3.8/GtkContainer.html#gtk-container-remove
I think the widget you are looking for is Gtk.ListBox. It's a container so you can add and remove rows easily.

DataGridViewComboBoxCell selectioindexchange event

I have a data-grid and three column in it. one column is type of DataGridViewComboBoxCell, three items are in this grid combo box, now i have to invoke selection index changed event to change value according to combo value change in grid.
also help me to make a new event ....
please help...
thanks
I really can't understand your question.
But maybe these informations can help:
A ComboBoxColumn has always two kinds of controls. A presenting one (in most cases a label) which is individually for each row. And a editing one that will be shared for the whole column. So take a look into this documentation and the IDataGridViewEditingControl Interface.
Maybe these will give you a starting point on how to solve your problem.
In the Load event for the form, you need to get the cell that you want to add the handler to and cast it as a regular combo box. You can then add the event handler on SelectedIndexChanged, but it must be done programmatically, and depending on the language you are using.