Nov 13, 2013, 3:37 PM
FileUploadField fires when I load a store from the controller
I have a long FormPanel that includes a few grids, a combobox, and a FileUploadField.
When I select something from the combobox, I go back to the controller, get my data, and Load the data directly into the grid's store.
Razor:
When the FileUploadField exists on the page, instead of the store loading data, the FileUploadField automatically fires (without clicking the button) and essentially pops up a message to download the JSON object being passed to the store from my controller...
How can I have both a grid's store loaded from controller, and the ability to use FileUploadField for separate functionality?
When I select something from the combobox, I go back to the controller, get my data, and Load the data directly into the grid's store.
Razor:
Html.X().GridPanel().ID("grdObjectSearch").Width(745).MarginSpec("5 0 0 0")
.MinHeight(150).MaxHeight(150)
.EmptyText("Select an Object Type to view the Impacted Objects list.")
.Store(
Html.X().Store().ID("storeImpactedObjects")
.Buffered(true)
.Model(Html.X().Model()
.Fields(
Html.X().ModelField().Name("ObjKey").Type(ModelFieldType.Int),
Html.X().ModelField().Name("ObjName").Type(ModelFieldType.String),
Html.X().ModelField().Name("ObjTypeKey").Type(ModelFieldType.Int),
Html.X().ModelField().Name("ObjTypeName").Type(ModelFieldType.String)
)
)
)
.ColumnModel(
Html.X().Column().DataIndex("ObjKey").ID("colWIObjSearchKey").Hidden(true),
Html.X().Column().DataIndex("ObjName").ID("colWIObjSearchName").Text("Object Name").Flex(2),
Html.X().Column().DataIndex("ObjTypeKey").ID("colWIObjSearchTypeKey").Hidden(true),
Html.X().Column().DataIndex("ObjTypeName").ID("colWIObjSearchTypeName").Text("Object Type").Flex(1)
),
Html.X().Container().Layout(LayoutType.HBox).MarginSpec("5 0 0 0")
.Items(
Html.X().Label().Text("Or:").PaddingSpec("0 10 0 0"),
Html.X().FileUploadField().ID("btnBrowse").Width(300)
.Listeners(li => li.Change.Fn = "passValue")
)
Controller:public ActionResult SingleWorkitem_ObjectType(string objectTypeKey)
{
int iObjectTypeKey = Convert.ToInt32(objectTypeKey);
List<ImpactedObject> lstImpactedObject = _wiService.GetImpactedObjectsByTypeKey(iObjectTypeKey);
List<ImpactedObjectLookup> lstImpactedObjectLookup =
lstImpactedObject.Select(io => new ImpactedObjectLookup()
{
ObjKey = io.ObjKey,
ObjName = io.ObjName,
ObjTypeKey = io.ObjTypeKey,
ObjTypeName = io.ObjTypeName
}).ToList<ImpactedObjectLookup>();
Store store = X.GetCmp<Store>("storeImpactedObjects");
store.LoadData(lstImpactedObjectLookup);
return this.Direct();
}
When I comment out the FileUploadField, this works as normal.When the FileUploadField exists on the page, instead of the store loading data, the FileUploadField automatically fires (without clicking the button) and essentially pops up a message to download the JSON object being passed to the store from my controller...
How can I have both a grid's store loaded from controller, and the ability to use FileUploadField for separate functionality?