User Profile & Activity

Ahmed Dajani Member
Page
of 6
Posted: August 30, 2012 2:16 PM
Thanks Hans. That solved the double line problem.

As for the sample you sent, it's not quite what I have. Can you please try the following:

- Add enough columns so that you will have to scroll to the right to see the rest of them.
- change the doc type to
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- Hide the first two columns in PrepareDataBinding when adding columns to the grid
- Set ActiveFrozenColumns = 2
- Try in both IE and Firefox.

I attached two images illustrating what happens in my case...
Posted: August 28, 2012 12:36 PM
Hans,

Thanks for your answer.

I think the issue was happenign because I was refreshing the grid immediatly after...Now I took out the refresh grid and what happens is attached...

I initially have ActiveFrozenColumns = 2. Then through JS on client side I set it to a different value like this...
grid.LayoutSettings.FreezePaneSettings.ActiveFrozenColumns = columnPos;grid.FreezePane(true);

I do this through a new column context menu item. It calls a function with these two lines of code.

In the image attached, you'll notice there are two lines for the freeze column. Any idea why?

Posted: August 26, 2012 10:39 PM
Another question regarding the same thing...I'm having an issue retreiving the ActiveFrozenColumn Property correctly.

I initialize my grid having ActiveFrozenColumns = 2. Later on, I set it to 4 on the client side as:
grid.LayoutSettings.FreezePaneSettings.ActiveFrozenColumns = columnPos;grid.FreezePane(true);

However,  later on when I refresh the page, and look on the server side at that property it is still 2. Why is that?


Posted: August 10, 2012 2:03 PM
Hans,

Thanks for the reply. This works great in IE but does not work well in Firefox. In Firefox, I have double click inside a cell, exit the edit mode and only then can move around using the arrow keys. Just want to make you aware of the issue.
It's fine I found a work around.

I would like to inform your developers of one thing that has been an issue. Sometimes when I hide a column, then run the following code on client side, the invisible columns are always at the end.

For example, if I create the columns as
col1:visible, col2:visible, col3:invisible, col4:visible, col5:visible
then run my code, I get the following:
col1:visible, col2:visible, col4:visible, col5:visible, col3:invisible

I don't understand why but I hope it is addressed with the next hot fix.

var grid = ISGetObject('myGrid');            var settings = "";
            for (var i = 0; i < grid.RootTable.Columns.length; i++) {
                    if (settings.length != 0 && i < grid.RootTable.Columns.length) {
                        settings += ","
                    }
                    settings += grid.RootTable.Columns[i].Name + ":" + grid.RootTable.Columns[i].Width + "px:" + grid.RootTable.Columns[i].Visible;
            }



Posted: August 6, 2012 8:50 AM
Thanks Yudi. That did it.
Actually there are lots of files involved...But here is the scenario.

- Same grid as above. I am dynamically adding the columns during the PrepareDataBinding event server side.

- User clicks a button, opens an iFrame window popup to choose the grid columns they want. When the iFrame posts back. It sends a comma dilimited string to the parent window through js (parent.modalCallback(callBackParams) which is assigned to returnObj.  You retreive the value as returnObj.newColumnSettings.

So,

parent.aspxfunction openPopup() {
  // I'm not using showModalDialog anymore. I'm using the JQuery ColorBox plugin, but I am adding this code as an explanation
  var returnObj = window.showModalDialog(URL, args, "edge:Raised;scroll:no;help:no;status:no;center:yes;resizable:no;dialogHeight:350px;dialogWidth:600px;dialogLeft:48px;dialogTop:50px;");
  var grid = ISGetObject(myGrid);
                            var columnSettings = returnObj.newColumnSettings.split(",");
                            for (var i = 0; i < columnSettings.length; i++) {
                                var settingTokens = columnSettings[i].split(":");
                                if (settingTokens[1] == "SHOW") {
                                    if (!grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = true;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Show();
                                    }
                                }
                                else if (settingTokens[1] == "HIDE") {
                                    if (grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = false;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).HideFromView();
                                    }
                                }
                            }
                            wgDoResize(true, true);
// this call posts back to the server so I can the new grid layout
refreshPage();
}

Now...the popup

function closeWindow(callbackParams) {
// call back params is an object in this case looks like {message: "some message", newColumnSettings: "a,comma,delim,string" }
                parent.modalCallback(callbackParams);
}


Hans,

It seems there is another issue with this approach...When I try to execute the following code in the JS, I always get a JS error as listed below. It seems to always break on either Show() or HideFromView();

Any ideas?

TypeError: va7744 is null[Break On This Error] 	...30); if (ve2630.tagName =="TR" ||ve2630.tagName =="TD") return wgab058.m3c386(ve...
ISRes....7200533 (line 9)

                            var grid = ISGetObject(myGrid);
                            var columnSettings = returnObj.newColumnSettings.split(",");
                            for (var i = 0; i < columnSettings.length; i++) {
                                var settingTokens = columnSettings[i].split(":");
                                if (settingTokens[1] == "SHOW") {
                                    if (!grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = true;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Show();
                                    }
                                }
                                else if (settingTokens[1] == "HIDE") {
                                    if (grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = false;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).HideFromView();
                                    }
                                }
                            }
                            wgDoResize(true, true);


I'm passing in a string that looks like colName:SHOW,colName:HIDE,colName:SHOW. I've confirmed that the strings are being split correctly as well.


Thanks!
This solution worked, but I had to add wgDoResize(true, true); after the call or else the columns would render weird on the grid.
Hi Hans,

Unfortunately I cannot use this approach in my code due to the nature of how we are creating the grid.

I now have another problem. When I initially load the grid, I am able to right click a column header and select "Remove This Column". The column is removed just fine. Then if I create another post back to try and change the columns, then, right click column header and chose "Remove This Column" The column disappears and reappears again with in a second. Have you ever encountered this? The same happens with resizing the column. The size just doesn't take.

To recreate:

1. Use the same grid markup above
2. Client side dynamically add a bunch of columns.
3. Try "Remove this column"
4. Then create a post back and change the columns from the server side
5. Try step 3 again.

Another thing I'd like to be able to do is call "Remove This Column" on any column from my JavaScript code. How can I do that? Example:

<script type="text/javascript">function removeColumn(colName) {
var grid = ISGetObject(gridName);
var col = grid.RootTable.Columns.GetNamedITem(colName);
// How can I do this step?
col.Visible = false;
// here I would like to create a post  back to the server so I can do some modification to my column list on the server side. 
refreshPage();
}
</script>


Thanks!
All times are GMT -5. The time now is 1:25 AM.
Previous Next