I'm trying to hide a column (via a css class with only "display:none" in it), that is working more or less (the remaining visible columns are a bit shifted to the right somehow). But when I enable the activation behaviour, I receive this Javascript error: "htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus".
Is there any way to be able to use hidden columns and activation without Javascript errors?
Pieter:
While you cannot use CSS to create hidden columns when using activation, there is a way around this issue. I recently did a post demonstrating how to implement an Ajax master/detail page where I hid the primary key data in a hidden SPAN rather than making the column hidden. You can check out the code and explanation here:
http://blogs.infragistics.com/blogs/cshoemaker/archive/2008/11/06/webdatagrid-ajax-master-detail.aspx
Hope this helps,
Craig
Craig,
Thanks for the reply, it's working now
However, if you turn on the paging behaviour, your solution isn't working completely since the row_index on a new page starts at 0 again resulting in not being able to find the span tag (since the "index" field from the codebehind file isn't restarting). I fixed this by calculating the id of the span tag by myself by doing something like this:
var behaviors = grid.get_behaviors();var selection = behaviors.get_selection();var paging = behaviors.get_paging();
var rowIndex = selectedRow.get_index();if (paging){ rowIndex += (paging.get_pageSize() * paging.get_pageIndex());}
var Id = $get("b" + rowIndex).innerHTML;
I stand corrected: paging and the solution Craig presented, doesn't work at all.
When you have 2 pages, everything is working fine on the first page and the second page. When you however go back from page 2 to 1, the javascript code can't find the span tag at all. I have tried to disable the AJAX functionality of the grid and took a look at the span id's being generated, these aren't correct. In my case I had a page size of 15, the first time I took a look at the generated span id's they were correct, but after switching to page #2 and back to #1, the first span id starts with 5...
Any idea's?
I will work on a sample to try and figure this out for you... how are you databinding? Are you using a data source control or just setting the datasource property and then calling databind?
I'm setting the datasource property to a LLBLGen collection, and then call the Databind method.
Okay looks what you need to do is reset the index variable back to zero each time the grid is paged:
protected void wdg_PageIndexChanged(object sender, Infragistics.Web.UI.GridControls.PagingEventArgs e){ this.index = 0;}
Let me know if this works for you...
Since we've updated the system used on our blogs, the URL in one of Craig's earlier posts referring to his blog no longer works. Here's the updated URL to the blog post:
http://blogs.infragistics.com/blogs/craig_shoemaker/archive/2008/11/06/building-an-ajax-master-detail-page-with-the-webdatagrid.aspx