Alright I made quite a progress with vb syntax.
_CompanyDetail.vbhtml
@ModelType ExtNETExamples.ExtNETExamples.CompanyModel
@(Html.X().Container() _
.Content(
@@<text>
@Using (Html.BeginForm()) _
@Html.AntiForgeryToken()
@<div Class="modal-content">
<div Class="modal-body">
<div Class="form-horizontal">
<h4> CompanyModel</h4>
<hr />
#@Html.ValidationSummary(True, "", New With {.Class = "text-danger"})
#@Html.HiddenFor(Function(model) model.ID)
<div Class="form-group">
#@Html.X().Menu().ID("PartialGirdContextMenu").Items(Html.X().MenuItem().Text("Delete ID").DirectEvents(Sub(ls)
ls.Click.Confirmation.ConfirmRequest = True
ls.Click.Confirmation.Message = "Are you sure you want to remove the company?"
ls.Click.Url = Url.Action("RemoveCompany")
ls.Click.ExtraParams.Add(New Parameter("id", "#{PartialGirdContextMenu}.param1", mode:=ParameterMode.Raw))
End Sub))
#@(Html.X().GridPanel() _
.ID("partialGrid") _
.Store(Html.X().Store() _
.ID("StorePartial") _
.Model(Html.X().Model() _
.IDProperty("partialIDs") _
.Fields(
New ModelField("ID", ModelFieldType.Int),
New ModelField("Name"),
New ModelField("Price", ModelFieldType.Float),
New ModelField("Change", ModelFieldType.Float),
New ModelField("PctChange", ModelFieldType.Float),
New ModelField("LastChange", ModelFieldType.Date)
)
) _
.DataSource(Model.companyList)
) _
.ColumnModel(
Html.X().Column().Text("ID").DataIndex("ID").Width(35),
Html.X().Column() _
.Text("Name") _
.DataIndex("Name") _
.Flex(1),
Html.X().Column() _
.Text("Price") _
.DataIndex("Price") _
.Renderer(RendererFormat.UsMoney),
Html.X().Column() _
.Text("Change") _
.DataIndex("Change"),
Html.X().Column() _
.Text("PctChange") _
.DataIndex("PctChange"),
Html.X().DateColumn() _
.Text("Last Updated") _
.DataIndex("LastChange") _
.Format("yyyy-MM-dd")
).View(Html.X().GridView().ID("partialGridView").Listeners(Sub(ls) ls.RowContextMenu.Handler = "e.stopEvent();App.PartialGirdContextMenu.showAt(e.getXY()); return false;")))
</div>
</div>
</div>
<div Class="modal-footer">
<input type="button" Class="btn btn-primary" onclick="alert('el');" value="Save"/>
</div>
</div>
End Using
</text>
)))
Index.vbhtml
@ModelType ExtNETExamples.ExtNETExamples.CompanyModel
@Code
ViewData("Title") = "Index"
End Code
@(Html.X().ResourceManager())
<h2>Index</h2>
@(Html.X().Menu().ID("ContextMenu").Items(
Html.X().MenuItem().Text("Delete Contact"),
Html.X().MenuItem().Text("Avery 5164"),
Html.X().MenuItem().Text("Copy"),
Html.X().MenuItem().Text("Envelope")
)
)
@Html.X().Menu().ID("GirdContextMenu").Items(Html.X().MenuItem().Text("Delete ID").DirectEvents(Sub(ls)
ls.Click.Confirmation.ConfirmRequest = True
ls.Click.Confirmation.Message = "Are you sure you want to remove the company?"
ls.Click.Url = Url.Action("RemoveCompany")
ls.Click.ExtraParams.Add(New Parameter("id", "#{GirdContextMenu}.param1", mode:=ParameterMode.Raw))
End Sub))
@(Html.X().GridPanel() _
.Title("Editable GridPanel") _
.Width(600) _
.Height(350) _
.ID("indexGrid") _
.Store(Html.X().Store() _
.ID("Store23") _
.Model(Html.X().Model() _
.IDProperty("IDs") _
.Fields(
New ModelField("ID", ModelFieldType.Int),
New ModelField("Name"),
New ModelField("Price", ModelFieldType.Float),
New ModelField("Change", ModelFieldType.Float),
New ModelField("PctChange", ModelFieldType.Float),
New ModelField("LastChange", ModelFieldType.Date)
)
) _
.DataSource(Model.companyList)
) _
.ColumnModel(
Html.X().Column().Text("ID").DataIndex("ID").Width(35),
Html.X().Column() _
.Text("Name") _
.DataIndex("Name") _
.Flex(1),
Html.X().Column() _
.Text("Price") _
.DataIndex("Price") _
.Renderer(RendererFormat.UsMoney),
Html.X().Column() _
.Text("Change") _
.DataIndex("Change"),
Html.X().Column() _
.Text("PctChange") _
.DataIndex("PctChange"),
Html.X().DateColumn() _
.Text("Last Updated") _
.DataIndex("LastChange") _
.Format("yyyy-MM-dd")
).View(Html.X().GridView().ID("indexGridView").DirectEvents(Sub(ls)
ls.RowDblClick.Url = Url.Action("EditDetail")
ls.RowDblClick.ExtraParams.Add(New Parameter("id", "record.data.ID", mode:=ParameterMode.Raw))
ls.RowDblClick.ExtraParams.Add(New Parameter("containerId", "detailWindow", mode:=ParameterMode.Value))
End Sub
).Listeners(Sub(ls) ls.RowContextMenu.Handler = "e.stopEvent();#{GirdContextMenu}.param1 = record.data.ID; #{GirdContextMenu}.showAt(e.getXY()); return false;")))
@Html.X().Window().ID("detailWindow").Modal(True).Hidden(True).Shadow(True).Width(800).AutoUpdateLayout(True)
Now if you run this code for the first time. Like Double click on GridPanel Row on Index page to view the Window with Partial view.
Right click on GridPanel on Window. It runs fine now. Though I am still need to get rid of # sign, that I had to use in vbhtml to say that Statement is ended.
but Now close the window, and again double click on row of index page. You will not the results, None of the ext.net controls got rendered this time. Now again close this window, and again do double click operation on row of index page, now nothing will be rendered. Not even html part, just white blank window.
Quite strange right.
Now at this point, I think something fishy is happening inside the controller. Can you please take a look at this issue, meanwhile I look at how to get rid of # signs?
HomeController.vb
Imports System.Web.Mvc
Imports System.Linq
Imports ExtNETExamples.ExtNETExamples
Imports Ext.Net.MVC
Imports Ext.Net
Namespace Controllers
Public Class HomeController
Inherits Controller
' GET: Home
Function Index() As ActionResult
Dim companyModel As New CompanyModel
companyModel.companyList = companyModel.GetAll()
Return View(companyModel)
End Function
Function EditDetail(id As Integer, containerId As String) As ActionResult
Dim cmModel As New CompanyModel
cmModel.companyList = cmModel.GetAll().Where(Function(m) m.ID = id).ToList()
If(cmModel.companyList IsNot Nothing)
For each item In cmModel.companyList
cmModel.ID = item.ID
cmModel.Name= item.Name
cmModel.Price = item.Price
cmModel.PctChange = item.PctChange
cmModel.LastChange = item.LastChange
cmModel.Change = item.Change
Next
End If
'Me.GetCmp(Of Container)(containerId).Show()
Dim ret As New Ext.Net.MVC.PartialViewResult()
ret.ViewName = "_CompanyDetail"
ret.Model = cmModel
ret.ContainerId = containerId
ret.RenderMode = RenderMode.AddTo
ret.ClearContainer = True
Me.GetCmp(Of Window)(containerId).Show()
Return ret
End Function
Function RemoveCompany(id As Integer) As ActionResult
Dim cmModel As New CompanyModel
cmModel.companyList = cmModel.GetAll().Where(Function(m) m.ID <> id).ToList()
Return View("Index",cmModel)
End Function
End Class
End Namespace
Edited:
I am not sure if this is helpful for you to debug, but I see this error in console, when Row is double clicked for second time.
Uncaught TypeError: Cannot read property 'lockingPartnerContext' of undefined