Hello,
We are using Map Suite MVC 8, is it possible to resize the map based on input from the client using AJAX calls?
We are using Kendo UI in our project, and I have setup a page that contains an AVL map and a Manifest using a Kendo Splitter to allow the user to determine the size of the map and table. As the user uses the splitter to change the size of the areas being displayed, I would like to redraw the map to avoid having any scroll bars. I have tried passing the desired size back from the client to the server via AJAX, updating the map object on the server, and then in the callback calling map.updateSize(), but I cannot get it to redraw at the new size. I suspect I am leaving out a step on either the client or server, or perhaps going about this in the wrong fashion.
Here is the relevant code :
function
resizeMap(height, width) {
var
params = {
mapHeight:height,
mapWidth: width,
};
try
{
mapObject.ajaxCallAction(mapController,
“ResizeMap”
, params, resizeMapCallback);
}
catch
(error) {
alert(error.message);
}
}
function
resizeMapCallback(response) {
if
(response !=
null
) {
try
{
mapObject.updateSize();
}
catch
(error) {
alert(error.message);
}
}
}
[HttpPost]
[MapActionFilter]
public
void
ResizeMap(Map map, GeoCollection<
object
> args)
{
if
(args !=
null
&& args.Count > 0)
{
double
height, width;
double
.TryParse(args[0].ToString(),
out
height);
double
.TryParse(args[1].ToString(),
out
width);
map.Height =
new
System.Web.UI.WebControls.Unit(height);
map.Width =
new
System.Web.UI.WebControls.Unit(width);
}
}
}