User Profile & Activity

Glenn Layaar Support
Page
of 99
Posted: May 17, 2010 4:37 AM

Unfortunately, swapping row has not been supported by WebGrid. I also could not find any workaround in order to swap row in the client side.

The method you proposed will not work because the row update function will only update the column value, not its attribute.

Posted: May 16, 2010 10:35 PM

For issue #1, you could use the OnCheckBoxClick client side event handler, this event will be raise for each checked row. In your case, you will need to set the checked property to the old value if the row checker is disabled. Here is the snippet:

function wgTest_OnCheckBoxClick(controlId, tblName, colName, checkboxValue, originalCheckBoxValue)
{
var wgTest = ISGetObject(controlId);

var chkBoxElem = wgTest.LastChkBox;

if (chkBoxElem.getAttribute("disabled") == true)
chkBoxElem.checked = originalCheckBoxValue;

return true;
}

For issue #2, in the OnAfterInitualize client side event handler, you will need to retrieve the checkbox header element and set the display style to none. Here is the snippet:

function wgTest_OnAfterInitialize(controlId)
{
var wgTest = ISGetObject(controlId);

var headerElem = wgTest.RootTable.GetElement(WG40.COLHEADER, WG40.HTMLDIV);

headerElem.getElementsByTagName('input')[0].style.display = "none";

return true;
}

The snippet use index 0 for the input because the checkbox is the first column in the WebGrid.

 

Open the Integrated WebGrid 7 Reference under Intersoft WebUI Studio 2009 R2 > WebUI Studio for ASP.NET > WebGrid 7.

Afterward, use the search feature with the search text "New Identity Insert" to find the article. The article should be on the top result.

In an autoincrement key value field, you will need to handle the scenario as explained on the article "New Identity Insert" in the WebGrid documentation.

There is a discussion regarding IE7 and WebGrid height in this thread.

Basically, IE7 is using improper standard implementation which will cause the height issue.

Regarding the overlapping issue, you will need to set the row style to overflow hidden. Here is the snippet:

<AlternatingRowStyle CustomRules="overflow: hidden;" />
<RowStyle CustomRules="overflow: hidden;" />

The header misalignment has been submitted as a bug report to our developer. We will inform you if there is any update for this issue.


Under such circumstances, you will need to use the OnAfterResponseProcess client side event handler. Based on the action name in the event handler you might need to invoke the resize height again.

Here is the modified snippet:

function GridCustomResize(controlId)
{
var wgScroll = ISGetObject(controlId);

if (IS.ie && IS.GetIEVersion() == 7)
{
var tableElem = wgScroll.RootTable.GetElement(WG40.BODY, WG40.HTMLTABLE)
var totalRows = tableElem.getElementsByTagName('tr').length;

//70 is the status bar height
//22 is the height of a single row content
wgScroll.SetHeight((70 + (24 * totalRows)));
}
}

function wgScroll_OnAfterInitialize(controlId)
{
GridCustomResize(controlId);

return true;
}

function wgScroll_OnAfterResponseProcess(controlId, actionName, lastRequestObject, xmlResponseObject)
{
var wgScroll = ISGetObject(controlId);

switch (actionName)
{
case "Paging":
GridCustomResize(controlId);
break;
}

return true;
}


Posted: May 13, 2010 11:20 PM

Unfortunately, WebGrid will not use the CellStyle text align property for the new row cell style. As a workaround, you will need to use the OnRowSelect client side event handler in order to apply the text align style for the new row. Here is the snippet:

function OrderDetails_WebGrid_OnRowSelect(controlId, tblName, rowIndex, rowEl)
{
var OrderDetails_WebGrid = ISGetObject(controlId);

if (rowEl.getAttribute("type") == "NewRow")
{
var rowObj = OrderDetails_WebGrid.GetRowByElement(rowEl);
var rightCell = ['Quantity_WebGridColumn', 'UnitPrice_WebGridColumn'];

for (var i = 0; i < rightCell.length; i++)
{
rowObj.GetCell(rightCell[i]).CellElement.style.textAlign = "right";
}

}

return true;
}


 

Posted: May 13, 2010 9:41 PM

I have modified the test sample to simulate the new detail in your scenario. I still could not replicate the strange behavior you mention in my environment. Could you modify the attached sample to replicate the strange behavior?

The test is done using the latest WebGrid 7 and WebUI Framework 3 build, which is build 402 and build 752.

Posted: May 12, 2010 3:24 AM

In my test, since you are using bounded data for the checkbox column you will not need to set the IsRowChecker property.

Regarding your issue, since the checkbox is bounded to the database field, you will need to make sure that the corresponding field in the database has already reflect the checkbox value in the WebGrid. The refresh button in the WebGrid will rebound the data from the database to the WebGrid again, so the rendered value reflect the databse value.   

All times are GMT -5. The time now is 11:47 PM.
Previous Next