Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
490
Webgrid issue.
posted

Hello,

I am having a web page with 4 webgrids which are placed in a webtab control. Each webgrid is placed in a separate tab.

Since this screen is majorily used for data entry work, users wanted the facility to move to the next grid using the "page down" key stroke.

To implement this I have used the client-side "EditKeyUpHandler" event to see if the "page down" key is pressed in the last cell of any of the grid. In such case the next web tab is first set as selected and then the first cell of the grid in that tab is set active. Below is the code for the same:

function UltraWebGrid1_EditKeyUp(gridName, cellId, key)
{
     var LaborCell = igtbl_getCellById(cellId);
     if (LaborCell.Column.Key =="LastCell" && key==34)
     {
        var myUltraWebGrid1=igtbl_getGridById('<%= UltraWebGrid1.ClientID %>');
        myUltraWebGrid1.endEdit();
        var ultraTab = igtab_getTabById('<%= UltraWebTab1.ClientID %>');
        ultraTab.setSelectedIndex(1);
        var myUltraWebGrid2=igtbl_getGridById('<%= UltraWebGrid2.ClientID %>');
        var myUltraWebGrid2Cell = igtbl_getCellById('ctl00xContentPlaceHolder1xUltraWebTab1xxctl1xUltraWebGrid2_anc_1');
        myUltraWebGrid2.setActiveCell(myUltraWebGrid2Cell);
        // Tell the WebGrid to enter edit mode
        myUltraWebGrid2.beginEdit();

     }
}


When the "page down" key is pressed in the last cell of the 4th grid focus is taken to the "Save All" button which saves all the changes to the database in one go. The problem here is that for some reason the data entered in the last row of each grid is not getting saved in the database. I think the issues could be that since I am not hitting the "enter Key"(and using the "page down" key to move to the next grid) in the last row, the grid is not able to understand that a new row has been added.

How can we fix this issue. Please help.

Also, this screen is used only for inserting data, no update or delete opertaion is required.


Thanks,
Rajiv

 

 

 

Parents
  • 28464
    posted

    Hello Rajiv,

    This is an interesting scenario. From what I see in the code, everything seems correct - the only thing that might be missing is calling the endEdit() method each time with a "force" - true - parameter. Here is what I can see in the docs for endEdit()

    http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebGrid_Object_CSOM.html

    endEdit

    This method can be called of the UltraWebGrid to discontinue editing of the UltraWebGrid and push the changes into the client object model.

    Parameters
    force

    Boolean. Optional. Forces exiting edit mode. In some circumstances the grid prevents the editor to be closed, for example the browser can generate minor changes of the elements layout when the editor should stay opened. Using this parameter will close the editor regardless of any external conditions.

     

    So maybe in the custom scenario you are using, you may need to call endEdit(true) to force the grid to save the last edit of the respective cell.

    Hope this helps.

Reply Children