PDA

View Full Version : [CLOSED] Problem with auto genarate extra column in gridpanel



matrixwebtech
Jul 27, 2014, 6:05 AM
Hi
I design a grid panel with bellow code


@using Ext.Net
@using Ext.Net.MVC
@{
var X = Html.X();
}
@X.ResourceManager()
@(
Html.X().Viewport()
.Layout(LayoutType.Fit)
.Border(false)
.Items(
Html.X().TabPanel()
.ID("TabPanel1")
.Layout(LayoutType.Absolute)
.Border(false)
.Plugins(plugins => plugins.Add(new TabCloseMenu()))
.Items
(
Html.X().GridPanel()
.ID("GridPanel1")
.Title("Purchese requisitions")
.Border(false).AutoScroll(false)
.Layout(LayoutType.Fit)
.Store(
Html.X().Store()
.ID("Store1")
.GroupField("strRequireDate")
//.DataSource(ViewBag.loadgrid)
.Model(
Html.X().Model()
.IDProperty("RequisitionID")
.Fields(

Html.X().ModelField().Name("ERPSystem_RequisitionNo").Type(ModelFieldType.String),
Html.X().ModelField().Name("strRequisitionDate").Type(ModelFieldType.String),
Html.X().ModelField().Name("strRequireDate").Type(ModelFieldType.String),
Html.X().ModelField().Name("strRequisition_Approved").Type(ModelFieldType.String),
Html.X().ModelField().Name("TotalRequisitionValue").Type(ModelFieldType.Float)


)
)
.ServerProxy(X.AjaxProxy()
//.Url(Url.Action("reloadgrid", " MaterialRequisitions"))
.Url("/MaterialRequisitions/reloadgrid")
.Reader(X.JsonReader().Root("data"))
)

.PageSize(10)
)
.ColumnModel(

Html.X().SummaryColumn()
.Text("Requisition No")
.DataIndex("ERPSystem_RequisitionNo")
.Hideable(false)
.SummaryType(SummaryType.Count)
.SummaryRenderer("return ((value === 0 || value > 1) ? '(' + value +' Requisitions)' : '(1 Requsition)');")
//.Width(100)
.Resizable(true),

Html.X().Column()
.Text("Requisition Date")
.DataIndex("strRequisitionDate")
.Width(100)
.Resizable(true)
,

Html.X().Column()
.Text("Require Date")
.DataIndex("strRequireDate")
//.Width(100)
.Resizable(true)
,

Html.X().Column()
.Text("Requisition Approved")
.DataIndex("strRequisition_Approved")
//.Width(100)
.Resizable(true)
,

Html.X().SummaryColumn()
.Text("Total Requisition Value")
.DataIndex("TotalRequisitionValue")
.SummaryType(SummaryType.Sum)
.Renderer(RendererFormat.UsMoney)
.SummaryRenderer("Ext.util.Format.usMoney")
// .Width(100)
.Resizable(true)


)
.View(
Html.X().GridView().MarkDirty(false)
)
.SelectionModel(
X.CheckboxSelectionModel()
.ID("s")
.Mode(SelectionMode.Multi)
.Listeners(le =>
{
le.SelectionChange.Handler = "";
})
)
.Features(
Html.X().GroupingSummary()
.ID("GroupingSummary1")
.GroupHeaderTplString("{name}")
.HideGroupedHeader(true)
.EnableGroupingMenu(false)
)
.BottomBar(
Html.X().PagingToolbar()
.HideRefresh(true)
)
.TopBar(
Html.X().Toolbar()
.Items(
Html.X().TextField()
.ID("txtSearch")
.EmptyText("Search by Module name")
.DirectEvents(de =>
{
de.Change.Action = "/search";
de.Change.ExtraParams.Add(new Parameter
{
Name = "data",
Value = "Ext.getCmp('txtSearch').getValue()",
Mode = ParameterMode.Value,
Encode = false
}
);
})
,
Html.X().Button()
.Text("Add record")
.Icon(Icon.Add)
.Handler(" AddTab(#{TabPanel1}, '/MaterialRequisitionsEntry/index','Material Requisition Entry');")


,
Html.X().Button()
.ID("btnEdit")
.Text("Edit record")
.Icon(Icon.ApplicationEdit)

.Handler("AddTabWithQueryString(#{TabPanel1}, '/MaterialRequisitionsEntry/index','Material Requisition Entry',#{GridPanel1},'RecordID','edit');")
,
Html.X().Button()
.Text("Delete selected")
.ID("btnDelete")
.Icon(Icon.Delete)
.DirectEvents(de =>
{
de.Click.Url = Url.Action("Delete");
de.Click.Confirmation.Message = "Are you sure to delete this entry?";
de.Click.Confirmation.ConfirmRequest = true;
de.Click.ExtraParams.Add(new Parameter()
{
Name = "selected",
Value = "App.GridPanel1.getSelectionSubmit().getSelectionMo delField().getValue()",
Mode = ParameterMode.Raw
});
de.Click.Complete = "App.GridPanel1.getStore().reload();";
})
,
Html.X().ToolbarFill(),
X.SplitButton()
.Text("Export")
.Menu(X.Menu()
.Items(
X.MenuItem()
.Text("Excel")
.Icon(Icon.PageExcel)
.Listeners(le =>
{
le.Click.Handler = "exportExcel('/MaterialRequisitions/ExportExcel', #{GridPanel1}.getRowsValues());";
}),
X.MenuItem()
.Text("CSV")
.Icon(Icon.ArrowDown)
.Listeners(le =>
{
le.Click.Handler = "exportCSV('/MaterialRequisitions/ExportCSV', #{GridPanel1}.getRowsValues());";
}),

X.MenuItem()
.Text("PDF")
.Icon(Icon.PageWhiteAcrobat)
.Listeners(le =>
{
le.Click.Handler = "exportPDF('/MaterialRequisitions/ExportPDF', #{GridPanel1}.getRowsValues());";
})
)
)
,
Html.X().Button()
.Text("Print")
.Icon(Icon.Printer)
.Handler("this.up('gridpanel').print();")
,


Html.X().Button()
.Text("Chart")
.Icon(Icon.ChartBar)
.Listeners(l =>
{
l.Click.Handler = " e.stopEvent(); AddTab(#{TabPanel1}, '/Dashboard/index','Vendor Registration Chart'); ";

})
)

)
)
)
)


But a extra column generate after "Total Requisition Value " ,I don't have any idea why this happen? please see screen shot.

geoffrey.mcgill
Jul 27, 2014, 1:21 PM
It's not an extra column, it's no column. Set .Flex(1) on one of your columns to fill the space.

matrixwebtech
Jul 27, 2014, 4:01 PM
thanks for reply.its works.can you please let me know what the Flex for?

geoffrey.mcgill
Jul 27, 2014, 11:28 PM
Information regarding the .Flex property is available in the documentation:

http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.layout.container.Box-cfg-flex