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

showInsertFormAt not working when drag

3 Answers 56 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Luis
Top achievements
Rank 1
Luis asked on 18 Oct 2010, 03:09 PM
Hello,

I can't figure out why doesn't display de inline form (showInsertFormAt, even showInlineInsertForm).
This only work if i remove the InlineInsertTemplate...

any clues?

<
telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadFormDecorator ID="RadFormDecorator1" DecorationZoneID="DecoratedControlsContainer"
        runat="server" />
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"
        Skin="Office2007">
    </telerik:RadWindowManager>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
 
        <script type="text/javascript">
            function OnClientAppointmentInserting(sender, eventArgs) {
                $find("<%= txtidFuncionario.ClientID %>").value = $get("txtidFuncionario").value;
                $find("<%= txtDiasPlanificados.ClientID %>").value = $get("txtDiasPlanificados").value;               
            }
            function OnClientTimeSlotClick(sender, eventArgs) {
                var slot = sender.get_activeModel().getTimeSlotFromDomElement(eventArgs.get_domEvent().target);
                sender.showInlineInsertForm(slot);
            }
            function OnClientAppointmentClick(sender, e) {
                var apt = e.get_appointment();
                sender.editAppointmentWithConfirmation(apt);
            }
            function rowDropping(sender, eventArgs) {
                var htmlElement = eventArgs.get_destinationHtmlElement();
                var scheduler = $find('<%= RadScheduler1.ClientID %>');
 
                if (isPartOfSchedulerAppointmentArea(htmlElement)) {
                    var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);
                    $find("<%= txtTargetSlot.ClientID %>").value = timeSlot.get_index();
                    eventArgs.set_destinationHtmlElement("txtTargetSlot");
                    scheduler.showInlineInsertForm(timeSlot);
                }
                else {
                    eventArgs.set_cancel(true);
                }
            }
            function isPartOfSchedulerAppointmentArea(htmlElement) {
                return $telerik.$(htmlElement).parents().is("div.rsAllDay") ||
                            $telerik.$(htmlElement).parents().is("div.rsContent")
            }
        </script>
 
    </telerik:RadScriptBlock>
    <telerik:RadTextBox ID="txtTargetSlot" runat="server" CssClass="hidden_field">
    </telerik:RadTextBox>
    <telerik:RadTextBox ID="txtidFuncionario" runat="server" CssClass="hidden_field">
    </telerik:RadTextBox>
    <telerik:RadTextBox ID="txtDiasPlanificados" runat="server" CssClass="hidden_field">
    </telerik:RadTextBox>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadSplitter ID="RadSplitter1" LiveResize="true" runat="server" Orientation="Vertical"
        Width="100%">
        <telerik:RadPane ID="RadPane1" runat="server" Width="160" MinWidth="160">
            <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="dsPersonal" Skin="Web20"
                OnItemDataBound="RadGrid1_ItemDataBound" GridLines="None" AutoGenerateColumns="False"
                OnRowDrop="RadGrid1_RowDrop" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                ShowFooter="True">
                <ClientSettings AllowRowsDragDrop="True">
                    <Selecting AllowRowSelect="True" />
                    <ClientEvents OnRowDropping="rowDropping" />
                </ClientSettings>
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="id_funcionario" DataSourceID="dsPersonal">
                    <CommandItemSettings ExportToPdfText="Exportar a PDF" />
                    <Columns>
                        <telerik:GridBoundColumn Visible="false" DataField="id_funcionario" HeaderText="id_funcionario"
                            SortExpression="id_funcionario" UniqueName="id_funcionario">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn ItemStyle-Width="100%" DataField="nombre_completo" HeaderText="Personal"
                            SortExpression="nombre_completo" UniqueName="nombre_completo">
                            <ItemStyle Width="100%" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn Visible="false" DataField="estado_cumplimiento" HeaderText="Estado Cumplimiento"
                            SortExpression="estado_cumplimiento" UniqueName="estado_cumplimiento">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </telerik:RadPane>
        <telerik:RadSplitBar ID="RadSplitBar1" runat="server" />
        <telerik:RadPane ID="RadPane2" runat="server">
            <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Web20" />
            <telerik:RadScheduler Height="398" runat="server" ID="RadScheduler1" DataEndField="fecha_hasta"
                DataKeyField="id_vacacion_planificada" DataSourceID="dsVacaciones" DataStartField="fecha_desde"
                DataSubjectField="id_vacacion_planificada" Skin="Web20" LastDayOfWeek="Sunday"
                OnClientTimeSlotClick="OnClientTimeSlotClick" OnClientAppointmentClick="OnClientAppointmentClick"
                Culture="Spanish (Chile)" AdvancedForm-EnableResourceEditing="true" AllowDelete="False"
                AdvancedForm-Enabled="False" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
                OnClientAppointmentInserting="OnClientAppointmentInserting">
                <%--<AdvancedForm Modal="true" />
                        <TimeSlotContextMenuSettings EnableDefault="true" />
                        <AppointmentContextMenuSettings EnableDefault="true" />--%>
                <AppointmentTemplate>
                    <span class="AppointmentTemplate_span">
                        <%# Eval("nombre_completo.Text") %></span>
                </AppointmentTemplate>
                <InlineInsertTemplate>
                    <div class="rsAdvancedEdit">
                        <div class="rsAdvTitle">
                            <h1 class="rsAdvInnerTitle">
                                Inserta una Planificación</h1>
                            <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose"
                                CommandName="Cancel" CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'>
       <%# Container.Appointment.Owner.Localization.AdvancedClose%>
                            </asp:LinkButton>
                        </div>
                        <div class="rsAdvContentWrapper">
                            <div class="frmTemplate">
                                <span class="tmp_span">Colaborador</span><span id="spanColaboradorInsert" runat="server"></span>
                                <br />
                                <span class="tmp_span">Fecha Desde</span>
                                <telerik:RadDatePicker ID="rdpFechaDesdeInsert" runat="server" Skin="Web20" />
                                <br />
                                <span class="tmp_span">Fecha Hasta</span>
                                <telerik:RadDatePicker ID="rdpFechaHastaInsert" runat="server" Skin="Web20" />
                                <br />
                                <span class="tmp_span">Dias Planificados</span>
                                <telerik:RadTextBox ID="txtDiasPlanificadosInsert" runat="server" Skin="Web20">
                                </telerik:RadTextBox>
                            </div>
                            <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">
                                <div class="rsAdvButtonWrapper">
                                    <asp:LinkButton CommandName="Insert" runat="server" ID="UpdateButton" CssClass="rsAdvEditSave">
<span><%# Container.Appointment.Owner.Localization.Save%></span>
                                    </asp:LinkButton>
                                    <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel"
                                        CausesValidation="false">
<span><%# Container.Appointment.Owner.Localization.Cancel%></span>
                                    </asp:LinkButton>
                                </div>
                            </asp:Panel>
                        </div>
                </InlineInsertTemplate>
                <InlineEditTemplate>
                    <div class="rsAdvancedEdit">
                        <div class="rsAdvTitle">
                            <h1 class="rsAdvInnerTitle">
                                Inserta una Planificación</h1>
                            <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose"
                                CommandName="Cancel" CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'>
       <%# Container.Appointment.Owner.Localization.AdvancedClose%>
                            </asp:LinkButton>
                        </div>
                        <div class="rsAdvContentWrapper">
                            <div class="frmTemplate">
                                <span class="tmp_span">Colaborador</span><span id="spanColaboradorEdit" runat="server"><%# Eval("nombre_completo.Text")%></span>
                                <br />
                                <span class="tmp_span">Fecha Desde</span>
                                <telerik:RadDatePicker ID="rdpFechaDesdeEdit" runat="server" Skin="Web20" DbSelectedDate='<%# Eval("fecha_desde.Text") %>' />
                                <br />
                                <span class="tmp_span">Fecha Hasta</span>
                                <telerik:RadDatePicker ID="rdpFechaHastaEdit" runat="server" Skin="Web20" DbSelectedDate='<%# Eval("fecha_hasta.Text") %>' />
                                <br />
                                <span class="tmp_span">Dias Planificados</span>
                                <telerik:RadTextBox ID="txtDiasPlanificadosEdit" runat="server" Skin="Web20" Text='<%# Eval("dias_planificados.Text") %>'>
                                </telerik:RadTextBox>
                            </div>
                            <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">
                                <div class="rsAdvButtonWrapper">
                                    <asp:LinkButton CommandName="Update" runat="server" ID="UpdateButton" CssClass="rsAdvEditSave">
<span><%# Container.Appointment.Owner.Localization.Save%></span>
                                    </asp:LinkButton>
                                    <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel"
                                        CausesValidation="false">
<span><%# Container.Appointment.Owner.Localization.Cancel%></span>
                                    </asp:LinkButton>
                                </div>
                            </asp:Panel>
                        </div>
                </InlineEditTemplate>
                <ResourceTypes>
                    <telerik:ResourceType DataSourceID="dsVacaciones" ForeignKeyField="fecha_desde" KeyField="fecha_desde"
                        Name="fecha_desde" TextField="fecha_desde" />
                    <telerik:ResourceType DataSourceID="dsVacaciones" ForeignKeyField="fecha_hasta" KeyField="fecha_hasta"
                        Name="fecha_hasta" TextField="fecha_hasta" />
                    <telerik:ResourceType DataSourceID="dsVacaciones" ForeignKeyField="nombre_completo"
                        KeyField="nombre_completo" Name="nombre_completo" TextField="nombre_completo" />
                    <telerik:ResourceType DataSourceID="dsVacaciones" ForeignKeyField="dias_planificados"
                        KeyField="dias_planificados" Name="dias_planificados" TextField="dias_planificados" />
                </ResourceTypes>
            </telerik:RadScheduler>
        </telerik:RadPane>
    </telerik:RadSplitter>

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 18 Oct 2010, 04:25 PM
Hi Luis,

The reason is that the showInsertFormAt() client-side method opens only the Advanced Form and not the inline insert/edit form. So that's the reason why your code works only when you remove the InlineInsertTemplate. Instead you can apply an AdvancedInsertTemplate and set the two properties:

StartInsertingInAdvancedForm = "true"
StartEditingInAdvancedForm = "true"

Hope this helps.

All the best,
Veronica Milcheva
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Luis
Top achievements
Rank 1
answered on 18 Oct 2010, 04:48 PM
thanks for your reply Veronica,
The strange thing is that when I click on the scheduler popsup correctly the inlineTemplate (showInlineInsertForm). The problem occurs only when I do the drop.

StartInsertingInAdvancedForm = "true"
StartEditingInAdvancedForm = "true"


this properties from above correctly show advanceform, but only when i'm clicking. Same error when i try to drop

my problem is that i can't show a form immediately after drop

thanks for your prompt response

0
Veronica
Telerik team
answered on 22 Oct 2010, 02:04 PM
Hello Luis,

To be able to show the Advanced Form right after drop - use OnRowDropped client-side event of the Grid instead of OnRowDropping.

Please let me know if this was helpful.

Regards,
Veronica Milcheva
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Luis
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Luis
Top achievements
Rank 1
Share this question
or