User Profile & Activity

Dave McGoff Member
Page
of 4
Posted: November 7, 2010 7:24 PM

Hi Yudi,

I have one remaining issue.  I need to send the value for each grouping item for the cell I am currently on.  For example, if we are grouped by Country, City, ContactTitle and I am selecting a cell within the Country of Japan, the City of Tokyo and ContactTitle of President.  How do I get those values?


I am able to get the value of the first Group - which is Country = Japan, but I can not get the last two groups.

I can get the Group Index and Group Array as well:

        var groupIndex = grid.GetSelectedObject().ToRowObject().GetGroupRowLevel();
        alert("groupIndex: " + groupIndex);
        var groupArray = groupIndex.split("_");

Here is how I get the Country Name:

        var groupName = grid.GetRootTable().GetGroupRows()[0].Cells[0].Text
        alert("groupName: " + groupName);


I thought I could get the city name by using that same line, but I receive a Javascript error:
	var groupName = grid.GetRootTable().GetGroupRows()[1].Cells[0].Text
         alert("groupName: " + groupName);

So How do I get the City Name and the ContactTitle for the select Cell/Row?

Thanks,

Dave

Posted: November 7, 2010 7:07 PM

Hi Yudi,

I have one remaining issue.  I need to send the value for each grouping item for the cell I am currently on.  For example, if we are grouped by Country, City, ContactTitle and I am selecting a cell within the Country of Japan, the City of Tokyo and ContactTitle of President.  How do I get those values?


I am able to get the

 

Posted: November 3, 2010 11:49 PM

Hi Yudi,

 

I need the GroupByExpression on the Client side - how do I get that?

 

Dave

Posted: November 3, 2010 10:17 PM

Hi Yudi,

 

How do I get the name of the columns being grouped by?  For example - "Country" and "City"?  I need to pass those to my WebService to actually run the query to update the Cell.

Also, how do I get the name of the current column that I am on? 

Dave

Posted: November 2, 2010 11:14 PM

Here is a sample.  If you expand a grouping and then rick click within one of the cells and select "Fill Down" you will see I am not getting anything for var pos= grid.GetSelectedObject().ToRowObject().ParentPos;

What I would like to do is call a WebService and pass the group information as well as the value and name of the current cell/column that I am filling down.  Within the WebService I will then make the update in the DB for that grouping.  Because I am doing Virtual Paging, I need to update on the server in order to update the rows that have not yet loaded to the client.

So I actually need all of the grouping info based on the current cell/row selected.


Dave

Hi Niven,

This does not work for me.  I am still getting the same error:  Message":"$0.09 is not a valid value for Decimal...

Here is my grid:

                            <ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="400px" UseDefaultStyle="True"
        Width="100$ispct;" DefaultStyleMode="Win7" ViewStateStorage="None" StateRestorationLevel="Low"
        BindingOperationMode="ClientBinding">
        <LayoutSettings  AllowColumnMove="Yes" AllowMultipleSelection="Yes" AllowDelete="Yes" AllowSelectColumns="Yes" AllowColumnFreezing="Yes" 
            AllowEdit="Yes" AllowGrouping="Yes" AllowSorting="Yes" PagingLoadMode="Custom"
            PagingMode="VirtualLoad" VirtualPageSize="20" PagingSize="15" PagingDataRetrievalMode="ReturnPartialRows"
            AllowBatchUpdate="false" RowHeightDefault="30" PagingStyleUI="Slider"
            MarkDefaultValuesAsDirty="false" VerboseEditingInformation="true" NewRowLostFocusAction="AlwaysUpdate"
            FocusNewRowOnLastCell="true" AutoFilterSuggestion="true" ShowFilterStatus="true"
            VirtualLoadMode="LargeData" HideColumnsWhenGrouped="No" GroupRowInfoFormatDefault="[caption]: [value] ([count])"
            AllowDefaultStyleMerging="true" GroupByBoxVisible="true" Culture="en-US">
            <FreezePaneSettings ActiveFrozenColumns="5" MaxFrozenColumns="6" />
            <ClientSideEvents OnAfterExitEditMode="WebGridAfterExitEdit" OnColumnContextMenu="OnColumnContextMenu" OnRowContextMenu="OnRowContextMenu"
                onrowvalidate="WebGrid1_OnRowValidate" OnEditKeyDown="WebGrid1_OnEditKeyDown"></ClientSideEvents>
            <HeaderStyle Height="35px" Wrap="False" />
            <ImageSettings ExpandImage="GroupPlus11.gif" CollapseImage="GroupMinus11.gif" />
            <GroupRowInfoStyle ForeColor="Black" Height="22px">
            </GroupRowInfoStyle>
            <TextSettings Language="UseCulture"></TextSettings>
        </LayoutSettings>
        <RootTable DataKeyField="PricingDrugCurrentTherapyDosingID" Caption="Dosings" GroupTotalVisible="true">
            <Columns>
                <ISWebGrid:WebGridColumn DataMember="Country" EditType="NoEdit" Caption="Country" Name="Country" />
                <ISWebGrid:WebGridColumn DataMember="PricingDrug" EditType="NoEdit" Caption="Pricing Drug" Name="PricingDrug" />
                <ISWebGrid:WebGridColumn DataMember="Strength" EditType="NoEdit" Caption="Strength" Name="Strength" />
                <ISWebGrid:WebGridColumn DataMember="Package" EditType="NoEdit" Caption="Package" Name="Package" />
                <ISWebGrid:WebGridColumn DataMember="UnitDescriptor" EditType="NoEdit" Caption="Unit Descriptor" Name="UnitDescriptor" />
                <ISWebGrid:WebGridColumn DataMember="ATC4" EditType="NoEdit" Caption="ATC4" Name="ATC4" />
                <ISWebGrid:WebGridColumn DataMember="CombinedMolecule" EditType="NoEdit" Caption="Combined Molecule" Name="CombinedMolecule" />
                <ISWebGrid:WebGridColumn DataMember="BrandGeneric" EditType="NoEdit" Caption="BrandGeneric" Name="BrandGeneric" />
                <ISWebGrid:WebGridColumn DataMember="Company" EditType="NoEdit" Caption="Company" Name="Company" />
                <ISWebGrid:WebGridColumn DataMember="Product" EditType="NoEdit" Caption="Product" Name="Product" />
                <ISWebGrid:WebGridColumn DataMember="LaunchDate" EditType="NoEdit" Caption="Launch Date" Name="LaunchDate" DataType="System.DateTime" AllowGrouping="No" DataFormatString="MM/dd/yyyy" />
                <ISWebGrid:WebGridColumn DataMember="Form1" EditType="NoEdit" Caption="Form1" Name="Form1" />
                <ISWebGrid:WebGridColumn DataMember="Form3" EditType="NoEdit" Caption="Form3" Name="Form3" />
                <ISWebGrid:WebGridColumn DataMember="ExManSales" EditType="NoEdit" Caption="ExManSales" Name="ExManSales" DataType="decimal" DataFormatString="0.00" />
                <ISWebGrid:WebGridColumn DataMember="UnitSales" EditType="NoEdit" Caption="Unit Sold" Name="UnitSales" DataType="decimal" DataFormatString="0.00" />
                <ISWebGrid:WebGridColumn DataMember="UnitType" EditType="NoEdit" Caption="UnitType" Name="UnitType" />
                <ISWebGrid:WebGridColumn DataMember="AutoWeight" EditType="NoEdit" Caption="Auto-Weights" Name="AutoWeight" DataType="decimal" AllowGrouping="No" DataFormatString="0.00" />
                <ISWebGrid:WebGridColumn DataMember="MyWeight" Caption="MyWeight" Name="MyWeight" DataType="decimal" />
                <ISWebGrid:WebGridColumn DataMember="DoseUnitsPerReportedPrice" Caption="DoseUnitsPerReportedPrice" Name="DoseUnitsPerReportedPrice" DataType="decimal" />
                <ISWebGrid:WebGridColumn DataMember="DoseUnitsPerAdminDay" Caption="DoseUnitsPerAdminDay" Name="DoseUnitsPerAdminDay" DataType="decimal"/>
                <ISWebGrid:WebGridColumn DataMember="MgPerDoseUnit" Caption="MgPerDoseUnit" Name="MgPerDoseUnit" DataType="decimal"/>
                <ISWebGrid:WebGridColumn DataMember="MgPerAdminDay" Caption="MgPerAdminDay" Name="MgPerAdminDay" DataType="decimal" />
                <ISWebGrid:WebGridColumn DataMember="DaysDurationOfDose" Caption="DaysDurationOfDose" Name="DaysDurationOfDose" DataType="decimal" />
                <ISWebGrid:WebGridColumn DataMember="PricePerUnit" EditType="NoEdit" Caption="PricePerUnit" Name="PricePerUnit" DataType="decimal" AllowGrouping="No" DataFormatString="$0.00" />
                <ISWebGrid:WebGridColumn DataMember="PricePerDoseUnit" EditType="NoEdit" Caption="PricePerDoseUnit" Name="PricePerDoseUnit" DataType="decimal" AllowGrouping="No" DataFormatString="0.00" />
                <ISWebGrid:WebGridColumn DataMember="PricePerAdminDay" EditType="NoEdit" Caption="PricePerAdmin" Name="PricePerAdminDay" DataType="decimal" AllowGrouping="No" DataFormatString="0.00" />
                <ISWebGrid:WebGridColumn DataMember="PricePerTreatedDays" EditType="NoEdit" Caption="PricePerTreatedDays" Name="PricePerTreatedDays" DataType="decimal" AllowGrouping="No" DataFormatString="0.00" />
                <ISWebGrid:WebGridColumn DataMember="Comments" Name="Comments" Caption="Comments" />
                <ISWebGrid:WebGridColumn DataMember="PricingDrugCurrentTherapyDosingID" Name="PricingDrugCurrentTherapyDosingID" Visible="False" />
                <ISWebGrid:WebGridColumn DataMember="IMSDrugID" Name="IMSDrugID" Visible="False" />
                <ISWebGrid:WebGridColumn DataMember="PricingDrugForecastCountryID" Name="PricingDrugForecastCountryID" Visible="False" />
            </Columns>

             <GroupedColumns>
                <ISWebGrid:WebGridGroup ColumnMember="Country" SortOrder="Ascending" />
            </GroupedColumns>
        </RootTable>
        <ClientBindingSettings DataLoadMode="PagedData" DataSourceType="WebService" PreloadGroupTotals="true"
            ItemTypeName="PricingDrugDosing" ServiceUrl="WS_PriceForecasterServices.asmx" EnableGroupRowPaging="true" GroupRowPageSize="20">
            <ServiceEvents  Selecting="GetCustomers_Selecting"  />
            <ServiceMethods DeleteMethod="deleteGridCurrentTherapyDosingByVersion" SelectMethod="getPagedCurrentTherapyDosingByVersion" UpdateMethod="updateGridCurrentTherapyDosingByVersion" />

        </ClientBindingSettings>
    </ISWebGrid:WebGrid>
Posted: November 2, 2010 12:44 PM

When I run:

var pos= grid.GetSelectedObject().ToRowObject().ParentPos;
alert("pos " + pos);


The result is that pos is blank!

Posted: November 2, 2010 12:27 PM

Yudi,

That sample is close, but there is one large difference.  I do not know what the user will group by - so I can't use a Case Statement.  How do I get those values dynamically?

 

Here is the psuedo code that I was thinking of:

ColumnName = GetCurrentCell.ColumnName

ValueToFill = GetCurrentCell.Text

GroupToUpdate = GetCurrentCell.MyGroup  //Could be grouped by multiple columns (City, Country,..)

//Update Client

For ALL Rows in GroupToUpdate

    Row.GetCell(ColumnName).Value = ValueToFill

//Update Server Side - need to update the values NOT currently displayed based on Virtual Paging

UpdateDatabaseOnServer(Group Info, Column Name, ValueToFill)

 

I need to be able to get to the Group Info for this specific cell.

Dave

 

 

 

Posted: November 1, 2010 1:02 PM

Handy,

Here is my issue - I am using the OnRowContextMenu to add a "Fill Down" option.  I am in a row within a group when I click on the "Fill Down" option.  That row does not have any children - it is a child.

I need to get all of the rows within that specific group.  I tried to getParent based on that row and then GetGroupChildRows() from there, but I get a javascript error - GetParent is returning a null:

 

                var grid = ISGetObject("WebGrid1");
                // get the WebGridRow object        // instead of element.
                var currentRow = grid.GetSelectedObject().GetRowObject();
                // get parent row
                var level = currentRow.GetGroupRowLevel();
                alert("Level: " + level);
                var parentRow = currentRow.GetParentRow();
                alert("The parent row of this order is: " + parentRow.KeyValue);

                // get group child rows of        // current row object.
                var groupChildRows = parentRow.GetGroupChildRows();
                var s = "Current selected group row is '" + parentRow.GroupRowText + "'. The child rows contained by this group are: ";
                for (var i = 0; i < groupChildRows.length; i++) {
                    var row = groupChildRows[i];
                    s += "Row " + i + ", Type=" + row.Type + ", KeyValue=" + row.KeyValue + " ";
                }
                alert(s);

 How do I get ALL of the rows for the Group I am currently in?

Dave

Posted: November 1, 2010 12:28 PM

Handy,

 

I am still getting the same error:

Microsoft JScript runtime error: 'GetGroupChildRows().length' is null or not an object


My solution is based on that same example - ClientBinding_VirtualGroupPaging.aspx.  I have just one level of grouping.

Can you send me your working sample?

Dave

All times are GMT -5. The time now is 8:43 PM.
Previous Next