This is a migrated thread and some comments may be shown as answers.

Batch editing in RadGrid - absolute position

1 Answer 15 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alfonso
Top achievements
Rank 1
Alfonso asked on 28 Jul 2015, 01:11 PM

Hi,

We are trying to set a custom EditItemTemplate in batch editing. We have a div and we want to put it above the edited cell. This code is working perfect in IE but it doesn't work fine in Chrome:

 

function batchEditOpened(sender, args) {
        var cell = args.get_cell();
        $cell = $(cell);
 
        var $batchContainer = $cell.find(".rgBatchContainer");
        $batchContainer.css("position", "absolute");
        $batchContainer.offset($cell.offset());
    }

Can you help us?

 

Thanks in advance,

 

Alfonso

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 31 Jul 2015, 06:24 AM
Hello Alfonso,

Can you please elaborate what exactly is the issue that you are facing in Chrome? I have tested the following example locally and the behavior is the same in IE and Chrome:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function batchEditOpened(sender, args) {
            var cell = args.get_cell();
            $cell = $(cell);
 
            var $batchContainer = $cell.find(".rgBatchContainer");
            $batchContainer.css("position", "absolute");
            $batchContainer.offset($cell.offset());
        }
    </script>
</telerik:RadCodeBlock>
 
<div>
    <telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView EditMode="Batch" AutoGenerateColumns="false">
            <Columns>
                <telerik:GridBoundColumn DataField="ID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FirstName"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <%#Eval("LastName") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <div style="width: 200px; height: 200px; background-color: lightgray;">
                            some content<br />
                            <telerik:RadTextBox runat="server"></telerik:RadTextBox><br />
                            some content
                        </div>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnBatchEditOpened="batchEditOpened" />
        </ClientSettings>
    </telerik:RadGrid>
</div>

And the dummy data:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    DataTable table = new DataTable();
    table.Columns.Add("ID", typeof(int));
    table.Columns.Add("FirstName", typeof(string));
    table.Columns.Add("LastName", typeof(string));
    table.Columns.Add("Age", typeof(int));
    table.Columns.Add("Date", typeof(DateTime));
    table.Columns.Add("BoolValue", typeof(Boolean));
    for (int i = 0; i < 5; i++)
    {
        table.Rows.Add(i, "FirstName" + i, "LastName" + i, 20 + i, DateTime.Now.AddDays(i), i % 2 == 0);
    }
 
    (sender as RadGrid).DataSource = table;
}

Looking forward to your reply with the additional information.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Alfonso
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or