Dec 19, 2014, 2:00 PM
[CLOSED] Unable to get the panels in Ext Net 3.0 DLL in Java Script
Hi Team,
I am working on the dynamic panels generation and drag and drop of the panels. in order to get the Exact X and Y value i am looping the code which i have implemented in ExtNet 1.7 DLL code.
Please find the code below
FormDesigner.aspx
FormDesigner.aspx.cs
The same code whih iam implementing with EXT Net 3.0 DLL.. but in the Javascript i am getting error while looping the ComponentMgr in the method "getAddedPanels ()".
Could you please help me out with this issue.
Thanks in Advance
Regards
BizBites
I am working on the dynamic panels generation and drag and drop of the panels. in order to get the Exact X and Y value i am looping the code which i have implemented in ExtNet 1.7 DLL code.
Please find the code below
FormDesigner.aspx
<ext:XScript ID="xsFormViewer" runat="server">
<script lang="javascript" type="text/javascript">
var getAddedPanels = function() {
debugger;
var sectionPanelsData = [];
var sectionQuestions=[];
//get all the controls in the pages
Ext.ComponentMgr.all.each(function(item) {
if (item.getXType() == "panel") { //get only Ext panels
var itemId = item.id;
if (itemId.indexOf("sectionPanel_") !== -1) { //finding the only section panels out of all panels
var spLimit=itemId.indexOf("sectionPanel_");//returns the starting positin of "sectionPanel_" from the id
var spstartLimit = parseInt(spLimit)+parseInt(13);//adding length of "sectionPanel_" to start limit from there only our sectionId starts
var spendLimit=parseInt(spstartLimit)+parseInt(36);//36 is the length of the guid
var spId=itemId.substring(spstartLimit,spendLimit);//getting the SectionId
var spSectionId = spId.replace(/\_/g,'-');//Replacing the _ with - to form the original Guid(Sectionid)
sectionPanelsData.push({sectionId:spSectionId, sectionName: item.title, sectionWidth: item.getWidth(), sectionHeight: item.getHeight(), sectionPositionX: item.x, sectionPositionY: item.y });
item.items.each(function(pnlitem)//get child controls of section // these controls are from sectiondesigner.ascx
{
//this is pnlColumn1 in the sectiondesigner.ascx
pnlitem.items.each(function(portalItem)
{
//this is portal for all the questions to drag and drop
var colIndex=0;
portalItem.items.each(function(portalColumnItem)
{
//this is portalColumn
var QuestionrowIndex =0;
portalColumnItem.items.each(function(portletItem)
{
//this is portlet
portletItem.items.each(function(portletPanelItem)
{
var PortletQueId=portletPanelItem.id;
if(PortletQueId.indexOf("_Question") !== -1)
{
var stLimit=PortletQueId.indexOf("_Question");//returns the starting positin of "_Question" from the id
var startLimit = parseInt(stLimit)+parseInt(9);//adding length of "_Question" to start limit from there only our questionId starts
var endLimit=parseInt(startLimit)+parseInt(36);//36 is the length of the guid
var secquestionId=PortletQueId.substring(startLimit,endLimit);//getting the questionId
secquestionId = secquestionId.replace(/\_/g,'-');//Replacing the _ with - to form the original Guid(Questionid)
sectionQuestions.push({sectionId:spSectionId , sectionName: item.title,QuestionId:secquestionId,QuestionColumnPosition:colIndex,QuestionRowPosition:QuestionrowIndex});
}
});
QuestionrowIndex = parseInt(QuestionrowIndex)+parseInt(1);
});
colIndex = parseInt(colIndex)+parseInt(1);
});
});
});
}
}
});
#{DirectMethods}.SetFormSectionPostions(sectionPanelsData,sectionQuestions);
parent.Ext.WindowMgr.getActive().hide();
}
var btnSelectQuestion = function() {
// parent.Ext.WindowMgr.getActive().hide();
var sectionPanelsData = [];
var sectionQuestions=[];
//get all the controls in the pages
Ext.ComponentMgr.all.each(function(item) {
if (item.getXType() == "panel") { //get only Ext panels
var itemId = item.id;
if (itemId.indexOf("sectionPanel_") !== -1) { //finding the only section panels out of all panels
var spLimit=itemId.indexOf("sectionPanel_");//returns the starting positin of "sectionPanel_" from the id
var spstartLimit = parseInt(spLimit)+parseInt(13);//adding length of "sectionPanel_" to start limit from there only our sectionId starts
var spendLimit=parseInt(spstartLimit)+parseInt(36);//36 is the length of the guid
var spId=itemId.substring(spstartLimit,spendLimit);//getting the SectionId
var spSectionId = spId.replace(/\_/g,'-');//Replacing the _ with - to form the original Guid(Sectionid)
sectionPanelsData.push({sectionId:spSectionId, sectionName: item.title, sectionWidth: item.getWidth(), sectionHeight: item.getHeight(), sectionPositionX: item.x, sectionPositionY: item.y });
item.items.each(function(pnlitem)//get child controls of section // these controls are from sectiondesigner.ascx
{
//this is pnlColumn1 in the sectiondesigner.ascx
pnlitem.items.each(function(portalItem)
{
//this is portal for all the questions to drag and drop
var colIndex=0;
portalItem.items.each(function(portalColumnItem)
{
//this is portalColumn
var QuestionrowIndex =0;
portalColumnItem.items.each(function(portletItem)
{
//this is portlet
portletItem.items.each(function(portletPanelItem)
{
var PortletQueId=portletPanelItem.id;
if(PortletQueId.indexOf("_Question") !== -1)
{
var stLimit=PortletQueId.indexOf("_Question");//returns the starting positin of "_Question" from the id
var startLimit = parseInt(stLimit)+parseInt(9);//adding length of "_Question" to start limit from there only our questionId starts
var endLimit=parseInt(startLimit)+parseInt(36);//36 is the length of the guid
var secquestionId=PortletQueId.substring(startLimit,endLimit);//getting the questionId
secquestionId = secquestionId.replace(/\_/g,'-');//Replacing the _ with - to form the original Guid(Questionid)
sectionQuestions.push({sectionId:spSectionId , sectionName: item.title,QuestionId:secquestionId,QuestionColumnPosition:colIndex,QuestionRowPosition:QuestionrowIndex});
}
});
QuestionrowIndex = parseInt(QuestionrowIndex)+parseInt(1);
});
colIndex = parseInt(colIndex)+parseInt(1);
});
});
});
}
}
});
debugger;
#{DirectMethods}.SetFormSectionPostions(sectionPanelsData,sectionQuestions);
#{DirectMethods}.btnSelectQuestion();
#{wndQuestions}.hide();
parent.Ext.WindowMgr.getActive().hide();
}
</script> </ext:XScript>
<div>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="pnlFormViewer" runat="server" AutoScroll="true" Height="20000" Layout="AnchorLayout">
<CustomConfig>
<ext:ConfigItem Name="insertProxy" Value="false" Mode="Raw" />
</CustomConfig>
<TopBar>
<ext:Toolbar ID="sTool" runat="server">
<Items>
<ext:Button ID="btnSavePostions" runat="server" Text="Done" Icon="Accept">
<Listeners>
<Click Handler="getAddedPanels();" />
</Listeners>
<%-- <DirectEvents>
<Click OnEvent="PositionFormSections">
</Click>
</DirectEvents>--%>
</ext:Button>
<ext:Button ID="btnCancel" runat="server" Text="Cancel" Icon="Cancel">
<Listeners>
<Click Handler="parent.Ext.WindowMgr.getActive().hide();" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Buttons>
<%-- <ext:Button ID="btnAddQuestions" runat="server" Text="Add Questions">
<DirectEvents>
<Click OnEvent="AddQuestionsToSelectedSections">
</Click>
</DirectEvents>
</ext:Button>--%>
</Buttons>
</ext:Panel>
</div>
FormDesigner.aspx.cs
protected override void OnInit(EventArgs e)
{
LoadDummyData();
}
private void LoadDummyData()
{
for (int i = 0; i <= 2; i++)
{
TestUserControl tst = (TestUserControl)this.LoadControl("~/UserControls/TestUserControl.ascx");
tst.ID = "test"+i.ToString();
Ext.Net.Panel pnlDyn = new Ext.Net.Panel();
pnlDyn.ID = "pnl" + i.ToString();
pnlDyn.Title = "Dynamic Panel";
pnlDyn.ContentControls.Add(tst);
pnlDyn.Width = 200;
pnlDyn.Height = 200;
pnlDyn.X = 50;
pnlDyn.Y = 100;
pnlDyn.Draggable = true;
pnlFormViewer.Items.Add(pnlDyn);
}
}
TestUserControl.ascx<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestUserControl.ascx.cs" Inherits="Kolme.PeopleRecords.UserControls.TestUserControl" %>
<table>
<tr>
<td>Name</td>
<td><ext:TextArea ID="txt" runat="server" /> </td>
</tr>
</table>
The same code whih iam implementing with EXT Net 3.0 DLL.. but in the Javascript i am getting error while looping the ComponentMgr in the method "getAddedPanels ()".
Could you please help me out with this issue.
Thanks in Advance
Regards
BizBites
Last edited by Daniil; Jan 06, 2015 at 4:27 PM.
Reason: [CLOSED]