Remove columns in dgrid dynamically - dojo

I am creating a dgrid using columnHider. I was able to hide/show columns using this.dgridTable.toggleColumnHiddenState(columnId, hidden);
However, I want to altogether remove specific columns from view(including the column hider menu). Is there a way to do this without re-creating the grid with a new set of columns?

You should be able to use this.dgridTable.set('columns', newColumnsDescription);. It does update the column hider menu as well.
You will have to build newColumnsDescription to reflect the addition / removal of columns as per your needs.

Related

Extending Kendo Grid default grouping

How can I implement some operations after kendo finishes grouping? For example, I am displaying some values based on countries, states, cities, etc. After grouping by those columns I would like to sum the values and display the total after each grouping group.
Also, how can I persist the columns state after grouping? For example, if I hide columns and then I decide to group by another column, the state gets refreshed (All columns will be displayed again). Is there a way to maintain the hidden columns after kendo finishes grouping by another column?
Thanks a lot!
1.After grouping the dataSource change event and grid dataBound are fired. In it you can use dataSource.group() method to get grouping infromation and use it like so:
function onDataBound(e) {
var gr = e.sender.dataSource.group();
//some operations on the gr variable.
}
Unfortunately it is not possible to check what exacly change in dataSource it was (grouping, filtering etc).
Better option is to use kendo aggregating mechanism to it. I recommed to try it first. Check this demo to see how it works.
2.Here is another demo I've prepared for you in which you can hide column using column menu and then group it. Hided columns remain hided after it. Can you reproduce your issue in that example if you still have problem with it?

Create DataTable child row without showing it?

I am using datatable (v1.10.2 with jquery 1.9.2) because I like the out-of-the-box features (searching/sorting etc). However, now I want the ability to:
1) use animations (sliding) when showing/hiding a row
2) have the hidden row available in the DOM to change (ie, it would exist but have a display:none).
My current code to create the table looks like the following (where formatChild() returns html for a table):
if (row.child.isShown()){
row.child.hide();
tr.removeClass('shown');
} else {
row = row.child(formatChild());
row.show();
tr.addClass('shown');
}
I am using several services to change data in the child row's table via ajax and want to be able to change that data even when the row is hidden. I know I can create a map in memory and use the information in the stored map when I show the child row, but to me it is much cleaner to change the hidden row immediately.
I was hoping I could do a row()child(), modify the row, then call row()child().show() but the row isn't created in the DOM after the row.child().
Regarding the animation, I found an answer here but it involves changing the datatables code :(
I considered just using jquery to add a row to the datatable and hide it, but I couldn't find a good way to "attach" it to the primary row for sorting.
The plan I am currently leaning towards is to add a div to my primary table row that I will show/hide/update rather than using child rows at all.
What is the best practice for managing these hidden areas in a datatable (and showing them with animation)? ty
In case anyone else has the same question, I ended up using a DIV in the row rather than using DataTables' child row. When I add a new row to the datatable, the div is hidden then I hide and show (slideup/slidedown) on a click event. This gives me the nice animations, keeps the sorting simple, and let's me change information in the hidden row. Interestingly, the DIV contains a table and the text that is in that table when I create the new row is searchable; however, the text in the table that my ajax call adds/modifies is not searchable. I'm looking into how I want that to work (and may keep the div out of the search altogether if possible).

Rowspan in oracle adf

In Oracle adf, would you please mention replacement of rowspan in af:column in af:table. I like to place a button between 2 columns and that button is vertically placed in one column which is between 2 columns.
you have to add new column between the existed two columns and add button inside the new column.
--Peddi
Using the PanelBox or panelGroupLayout components, change the alignment to horizontal.

Dojo Grid with editable and non-editable cells

We are using dojo 1.4.2 in our project. We have a page where we display a dojox.data.EnhancedGrid from ItemFileWriteStore. We have a use case based on the user access, we need to have a column editable for some rows; for rest of the rows this column should be read only.
So what we are looking at is setting the editable:true at the cell level and not at the column level. All the examples I see are set at the column level. Is there a way to set editable at the cell level?
I haven't found a way to set any options (such as editable) at the cell level. As far as I can tell, all options can only be set at the column level.

Add new row to gridview

I'm using a gridview to display and access a sql database and using databinding. I'm also using autogenerate columns as one gridview has multiple sources and toggles between them. What would be the best way to allow the user to insert a new row?
Would a listview be better?
Easiest way to to add a detailsview, set it to the datasource of the gridview and done.
What about changing the DataGridView.EditMode property to something other than EditProgramatically?
FormView on the page, DefaultMode = Insert, and provide an Insert Template.
Add buttons / visibility toggles / datahookup etc. as needed.