PDA

View Full Version : [CLOSED] MVC syntax



susanz
Sep 08, 2014, 5:27 PM
Hi, I try to add tooltip on grid row. Found example:
<ext:ToolTip
runat="server"
Target="={#{GridPanel1}.getView().el}"
Delegate="={#{GridPanel1}.getView().itemSelector}"
TrackMouse="true">
<Listeners>
<Show Handler="onShow(this, #{GridPanel1});" />
</Listeners>
</ext:ToolTip>

what is syntax to set target if my grid id is "grid" + Model.GridID ?



..
.ToolTips(
X.ToolTip()
.Target("#{'grid' + Model.GridID}.getView().el") // this line does not work


Thanks

susanz
Sep 08, 2014, 6:20 PM
The other issue is where to put the tooptip block. inside viewPort.items?

[CODE]
@(
X.Viewport()
.Layout(LayoutType.Fit)
.Items(
Html.X().GridPanel()
.ID("gPanel" + Model.GridIDInt) //GridPanel ID
//.Cls("x-grid-custom")
.Layout(LayoutType.Anchor)
.DefaultAnchor("100%")
.Title("DataEntry -- " + Model.Title)
.MessageBusListeners(new MessageBusListener
{
Name = "Grid." + Model.GridIDInt,
Handler = "ReLoadGrid(data, this);"
}
)
.Icon(Icon.Table)
.Frame(true)
.Store(
X.Store()
.ID(Model.GridID)
.Model(Model.StoreModel)
.RemotePaging(false)
.PageSize(20)
.Proxy(X.AjaxProxy()
//.API(action =>
//{
// action.Read = Url.Action("LoadGridData", "Grid");
// //action.Sync = "Sync";
//})
.Reader(X.JsonReader().Root("data").MessageProperty("message"))
.Url(Url.Action("LoadGridData", "Grid"))
)
.ShowWarningOnFailure(false)
.Listeners(events =>
{
events.Exception.Fn = "onStoreException";
})
.Parameters(new { gridId = Model.GridIDInt })
)// end store
.PrepareToolbar(t =>
{
t.Handler = "toolbar.items.get(0).setVisible(record.dirty);";
})
.Listeners(l =>
{
l.Command.Handler = "record.reject();";
})
)
.ColumnModel(Model.Columns) //define display columns
.TopBar(
X.Toolbar()
.Items(
X.Button()
.Text("Add")
.Icon(Icon.Add)
.Handler("onAddRow (this.up('grid'))"),
X.Button()
.Text("Delete")
.ID("btnDelete")
.Icon(Icon.Delete)
.Handler("this.up('grid').deleteSelected()"), //if(!this.up('grid').hasSelection()){ #{btnDelete}.disable();}"),

X.Button()
.Text("Save All")
.Icon(Icon.Disk)
.DirectEvents(de =>
{
de.Click.Url = Url.Action("SaveGridDataChanges", "Grid", new { gridID = Model.GridIDInt });
de.Click.Before = "return ValidateGridData(this.up('grid'))";
de.Click.Confirmation.ConfirmRequest = true;
de.Click.Confirmation.Title = "Save ?";
de.Click.Confirmation.Message = " Are you syre you want to save changes?";
de.Click.ExtraParams.Add(new Parameter
{
Name = "data",
Value = "this.up('grid').store.getChangedData({skipIdForPha ntomRecords : false})",
Mode = ParameterMode.Raw,
Encode = true
});
de.Click.Success = "onSaveSucess (this.up('grid'))"; //"this.disabled(); this.up('grid').getStore;";
de.Click.Failure = "onSaveFailure(result)";

}),
)//end toolbar items
)//end toolbar
.BottomBar(X.PagingToolbar())
.SelectionModel(
X.RowSelectionModel()
.Mode(SelectionMode.Single)

)
.View(
X.GridView()
.StripeRows(true)
.LoadingText("Loading Grid Data...")
.GetRowClass(fn => fn.Fn = "GetRowClass")

)// end view
.Listeners(ls =>
ls.ValidateEdit.Fn = "validateEditor" // this works
)
.Plugins(
X.CellEditing().ClicksToEdit(1)
)
.Features(
X.Grouping()
.ID("Grouping1")
.HideGroupedHeader(true)
.GroupHeaderTplString("{columnName}: {name} ({[values.rows.length]} {[values.rows.length > 1 ? \"Items\" : \"Item\"]})"),
X.RowWrap(),

X.Summary().ID("Total" + Model.GridIDInt)
),

// this does not work
//X.ToolTip ()
//.Target("#{'gPanel' + Model.GridIDInt}.getView().el}")
//.Delegate("#{'gPanel' + Model.GridIDInt}.getView().itemSelector}")
//.TrackMouse(true)
//.Listeners(ls => ls.Show.Fn = "onShowTop(this, this.up('grid'));")


) // end items


)