Batch editing in RadGrid - absolute position

2 posts, 0 answers
  1. Alfonso
    Alfonso avatar
    19 posts
    Member since:
    Jul 2013

    Posted 28 Jul 2015 Link to this post

    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

     

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2447 posts

    Posted 31 Jul 2015 Link to this post

    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
Back to Top