Hi,
I have been trying to get the copy() function to work for my WebGrid, but it keeps returning false. Here is my javascript code for capturing the context menu:
//Firefox passes event arg as parameter (evt). If that is null, we'll use window.event (Internet Explorer proprietary)
//Call show menu with menuID
//specify clientX and clientY to get more accurate positioning for this particular layout
//Firefox (W3C) - cancel event
//InternetExplorer (Proprietary) - cancel event
return false;
}
{
//Grab a reference to the ContextMenuItem that was clicked on
var oGrid = igtbl_getGridById("ugContacts");
if(item!=null){
//We'll use the text from the menuitem to decide which operation to perform
oGrid.selectRowRegion(oGrid.Rows.getRow(0), oGrid.Rows.getRow(nRows-1));
break;
oGrid.copy();
case "Export To Excel":
//Because the WebGrid consumes all mouse events, we need to add
//a listener to determine when a mouse click has occured so we can
//close the popup menu appropriately
The "Select All" and "Export to Excel" functions properly, but the copy returns a false when I capture it's return value.
I have a WebGrid in a page, it is hierarchical, and I have CellClickActionDefault set to RowSelect. Here is my UltraWebGrid setup:
oninitializelayout="ugContacts_InitializeLayout"
OnDataBinding="ugContacts_DataBinding">
<Bands>
<igtbl:UltraGridBand>
<AddNewRow Visible="NotSet" View="NotSet"></AddNewRow>
</igtbl:UltraGridBand>
</Bands>
name="UltraWebGrid1" rowheightdefault="-1px" selecttypecelldefault="Extended"
viewtype="Hierarchical" CellPaddingDefault="5" ColWidthDefault="-1px" GridLinesDefault="None"
allowsortingdefault="OnClient" enableclientsiderenumbering="True"
sortcasesensitivedefault="False" CellClickActionDefault="RowSelect">
font-names="Microsoft Sans Serif" font-size="XX-Small" height="560px"
width="100%">
</framestyle>
<Images ImageDirectory="./ig_res/Default/images/">
<CollapseImage Url="igg_sortAsc.gif" />
<ExpandImage Url="igg_sortDesc.gif" />
</Images>
Font-Size="XX-Small" BackColor="#CCCCCC" BorderColor="#0144D0"
BorderStyle="None" BorderWidth="0px">
<Padding Left="3px" />
<BorderDetails ColorLeft="White" ColorTop="White" />
</RowAlternateStyleDefault>
<ClientSideEvents MouseUpHandler="ugContacts_MouseUpHandler" />
<pager>
<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
widthtop="1px" />
</PagerStyle>
</pager>
font-size="XX-Small" Font-Bold="True">
</headerstyledefault>
borderwidth="0px" font-names="Microsoft Sans Serif" font-size="XX-Small">
<padding left="3px" />
<borderdetails colorleft="White" colortop="White" />
</rowstyledefault>
<SelectedRowStyleDefault BackColor="#9FBEEB">
</SelectedRowStyleDefault>
<GroupByBox Hidden="True">
</GroupByBox>
<addnewbox>
Font-Names="Microsoft Sans Serif" Font-Size="XX-Small">
</boxstyle>
</addnewbox>
borderstyle="None">
</activationobject>
<AddNewRowDefault>
<RowStyle Font-Names="Microsoft Sans Serif" Font-Size="XX-Small" />
</AddNewRowDefault>
</displaylayout>
</igtbl:UltraWebGrid>
Am I missing something? Do I have a setting improperly set? Or is this not possible with hierarchical grids?
I appreciate any assistance.
Mark
Try setting your CellClickActionDefault in display layout properties of your grid to select a cell and then add row selectors to your grid to select rows. See if this setting helps zero in on the cell and copy the cell correctly. Note that I have not got the copy functionality working in FF.