PDA

View Full Version : [CLOSED] GridPanel ComboBox editor using AjaxProxy: Display blank column MVC



matrixwebtech
Oct 07, 2014, 7:13 PM
Hi ,
I found almost same problem (http://forums.ext.net/showthread.php?43461-GridPanel-ComboBox-editor-using-PageProxy-Display-blank-column),
but my application in MVC.

Renderer Script


var MaterialCatergoryRenderer = function (value) {

var r = App.Store_MaterialCatergory.getById(value);
if (Ext.isEmpty(r)) {
return "";
}

return r.data.CategoryName;
};

Store

X.Store()
.ID("Store_MaterialCatergory")
.Model(
X.Model()
.IDProperty("MaterialCatergoryID")
.Fields(
X.ModelField()
.Name("MaterialCatergoryID")
.ServerMapping("MaterialCatergoryID")
.Type(ModelFieldType.Int)
,
X.ModelField()
.Name("CategoryName")
.ServerMapping("CategoryName")
.Type(ModelFieldType.String)

)
)
.AutoLoad(false)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("../QuotationEntry/Pur_Master_MaterialCategory_Get"))
.Reader(Html.X().JsonReader().Root("data"))

)

.Listeners(l=>{
l.Load.Handler = "App.Store_MaterialCatergory.load();";
l.Load.Single = true;
})
//.DataSource(ViewBag.MaterialCatergory)
)

Combobox Inside Grid

X.Column()
.DataIndex("MaterialCatergoryID")
.Text("Category")
.Renderer("MaterialCatergoryRenderer")

.Sortable(false)
.MenuDisabled(true)
.Editor(
X.ComboBox()
.QueryMode(DataLoadMode.Local)
.StoreID("Store_MaterialCatergory")
.ValueField("MaterialCatergoryID")
.DisplayField("CategoryName")
.AllowBlank(false)
.SelectOnFocus(true)
.SelectOnTab(true)

.Triggers(
Html.X().FieldTrigger().Icon(TriggerIcon.Clear).Qt ip("Remove selected")
)
.Listeners(l =>
{


l.TriggerClick.Handler = "this.clearValue();";
l.Focus.Handler = @"if(this.getValue()==0)
{
this.clearValue()
};";
})
.EmptyText("Select")

)
I do as per Daniil's suggestion ,but not working.

Daniil
Oct 08, 2014, 7:19 PM
Hi @matrixwebtech,


I do as per Daniil's suggestion ,but not working.

It looks you've set up .AutoLoad(false) for the ComboBox's Store. My suggesting was to set it for the GridPanel's ComboBox.

The idea is - the ComboBox's Store should gets its data before rendering of the GridPanel, because that data is used in the Renderer.

matrixwebtech
Oct 08, 2014, 8:07 PM
Hi Daniil,Sorry for that,Its my mistake.I setup properly and now its works,you can close this.