Originally Posted by
Daniil
Do you mean the expandRow/collapseRow methods?
Well, according to my code snippets these methods are a RowExpander's ones.
Please provide a test case to reproduce a JavaScript error.
.cshtml
@using System.Diagnostics
@using Core.Framework.Common.Enumerations
@using Core.Framework.Model.DesktopModel.SearchModel
@{
var model = Model as ModelSearchCorePermission;
bool canSave;
bool canAdd;
bool canDelete;
bool canEdit;
bool.TryParse(model.CanExecute, out canSave);
bool.TryParse(model.CanAdd, out canAdd);
bool.TryParse(model.CanDelete, out canDelete);
bool.TryParse(model.CanEdit, out canEdit);
}
@( Html.X().Panel()
.Layout(LayoutType.Fit)
.AutoDoLayout(true)
.Items(
(Html.X().Panel()
.Layout(LayoutType.Fit)
.Items(item => item.Add(
Html.X().GridPanel().ID("gridResult")
.TopBar(Html.X().Toolbar()
.Items(tbItem =>
{
tbItem.Add(Html.X().Button().Icon(Icon.Disk).Disabled(!canSave).DirectEvents(de =>
{
de.Click.Url = Url.Action("SaveAcRatingScale", "AcRatingScale");
de.Click.ExtraParams.Add(new Parameter("data", "#{ratingScaleStore}.getChangedData({skipIdForNewRecords : false})", ParameterMode.Raw, true));
de.Click.Success = "SaveDataSuccess(response,result,this,type,action,#{ratingScaleStore});";
}).Text((Compensation.UI.Controllers.Base.BaseController.GetLabelText("LBL_SYC_BUTTON_TEXT"))));
tbItem.Add(Html.X().Button().Icon(Icon.Add).Disabled(!canAdd).DirectEvents(de =>
{
de.Click.Url = Url.Action("AcRatingScaleResult", "AcRatingScale");
de.Click.ExtraParams.Add(new Parameter("containerId", "ctlSearchViewPort", ParameterMode.Value));
}).Text(Compensation.UI.Controllers.Base.BaseController.GetLabelText(Core.Framework.Common.Constants.ResourceLabelConstants.LBL_ADD_NEW_RECORD_TEXT)));
})
)
.Border(false)
.Store(Html.X().Store()
.PageSize(new Compensation.UI.Controllers.Base.GlobalSettingsController().GetPageData(Core.Framework.Common.Constants.GlobalSettingsConstantKeys.RESULT_PER_PAGE))
.ID("ratingScaleStore")
.AutoLoad(false)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("SearchResult", "Search"))
.ExtraParams(p => p.Add(new Parameter("searchType", SearchType.RatingScale.ToString())))
.ExtraParams(p => p.Add(new Parameter("controlType", ControlType.Grid.ToString())))
.Reader(Html.X().JsonReader().Root("data"))
)
.RemoteSort(true)
.RemotePaging(true)
.Model(Html.X().Model().IDProperty("id").Name("AcRatingScale")
.Fields(
new ModelField("RatingScaleId", ModelFieldType.String),
new ModelField("Title", ModelFieldType.String),
new ModelField("Description", ModelFieldType.String),
new ModelField("DomainId", ModelFieldType.String),
new ModelField("LastUpdateDateTime", ModelFieldType.Date, "MM/dd/yyyy"),
new ModelField("LastUpdateUser", ModelFieldType.String)
)
)
)
.ColumnModel(
Html.X().Column().Text("Rating Scale Id").DataIndex("RatingScaleId").Draggable(false).Width(200),
Html.X().Column().Text("Title").DataIndex("Title").Draggable(false),
Html.X().Column().Text("Description").DataIndex("Description").Draggable(false),
///row command for rating Points
Html.X().CommandColumn().Text("RatingPoints").Draggable(false)
.Commands(
Html.X().GridCommand().CommandName("Search").Icon(Icon.SportFootball).ToolTip(tt => tt.Text = "Search Rating Points"),
Html.X().GridCommand().CommandName("edit").Icon(Icon.BasketEdit).ToolTip(tt => tt.Text = "Edit Rating Scale")
)
.Listeners(l => l.Command.Handler = "Ext.Msg.alert(command, record.data.RatingScaleId)"),
Html.X().Column().Text("DomainID").DataIndex("DomainId").Draggable(false),
Html.X().Column().Text("Last Update User").DataIndex("LastUpdateUser").Draggable(false),
Html.X().Column().Text("Last Update Time").DataIndex("LastUpdateDateTime").Draggable(false),
Html.X().CommandColumn().SetDocked(Dock.Left).Text("Action").Draggable(true).Region(Region.West).Commands(
Html.X().GridCommand()
.CommandName("Edit")
.Icon(Icon.BugEdit)
.StandOut(true)
///When clicked the row needs to expand
.ToolTip(tt => tt.Text = "Edit Rating Scale"),
// Html.X().CommandSeparator(),
Html.X().GridCommand()
.CommandName("Delete")
.StandOut(true)
.Icon(Icon.Delete)
.ToolTip(tt => tt.Text = "Delete Rating Scale"),
// Html.X().CommandSeparator(),
Html.X().GridCommand().CommandName("reject").Icon(Icon.ArrowUndo)
)
.Listeners(ls=>ls.Command.Handler="OnGridCommandClick(command,record,#{gridResult});")
.PrepareToolbar("toolbar.items.get(2).setVisible(record.dirty);")
)
.View(Html.X().GridView().StripeRows(true).TrackOver(true))
.BottomBar(
Html.X().PagingToolbar()
.DisplayInfo(true)
.DisplayMsg(Compensation.UI.Controllers.Base.BaseController.GetLabelText(Core.Framework.Common.Constants.ResourceLabelConstants.LBL_PAGING_MESSAGE_TEXT))
.EmptyMsg(Compensation.UI.Controllers.Base.BaseController.GetLabelText(Core.Framework.Common.Constants.ResourceLabelConstants.LBL_PAGING_EMPTY_MESSAGE_TEXT))
)
)
))
))
The JavaScript
var OnGridCommandClick = function (command, record,grid) {
debugger;
if (command == 'Edit') {
grid.getRowExpander().expandRow(0);
}
else if(command=='Delete')
{
alert("delete");
deleteRecord(grid);
}
else if (command == 'reject')
{
//alert("reject");
record.reject();
}
}