Telerik Forums
Kendo UI for jQuery Forum
1 answer
107 views
I am fairly new to MVC
I have tried all day to use the MVVM Remote Binding example to update the model using form post instead of json to post to a controller action and it won't map the post data to the IEnumerable<ProductViewModel> products argument of my controller action. I have inspected the post parameters and this is what I see:

models[0][Discontinued] false
models[0][ProductID] 3
models[0][ProductName] Aniseed Syrup
models[0][UnitPrice] 12
models[0][UnitsInStock] 13
models[0][UnitsOnOrder] 0

In the working example for Kendo Grid Editing Custom, I noticed that the post parameters should be more like this:

models[0].Discontinued false
models[0].ProductID 3
models[0].ProductName
Aniseed Syrup
models[0].UnitPrice 12
models[0].UnitsInStock 13
models[0].UnitsOnOrder 0

Notice how the properties are not indexed. I am guessing that this is why it doesn't work.

Does anyone have a working example (with controller source) of Kendo MVVM being used to update the model?
Nathan
Top achievements
Rank 1
 answered on 25 Sep 2012
3 answers
301 views
Hello,

First off, thanks for putting together a great suite of controls. You've made my life as a mobile environment developer much easier! I do have a question though. I see in the release notes and in the documentation that the mobile View supports an event called "beforeShow".  Is there an example somewhere that utilizes that event? I'm trying to wire up some logic around the browser's back button and I'd like to use that event to determine if the user is logged in before displaying the requested view. When I try to attach a handler to the event like so:

<div data-role="view" id="someView" data-show="showSomeView" data-beforeShow="viewBeforeShow">
/* div content here */
</div>


The viewBeforeShow method never fires.  The showSomeView event works as expected, but the user is able to navigate back to that view even though they are no longer logged in to the app (exactly the case I'm trying to prevent). 

Here is the code for viewBeforeShow:

function viewBeforeShow(view) {
    if(loggedOut == true) {    // loggedOut is just a global variable for now
        window.kendoMobileApplication.navigate('#loginView');  // loginView is the login mobile view
    }
}

I don't know if this is the correct way to handle this scenario, but I can figure that out once I start handing the event.

I should mention I'm using the trial version 2012.2.710 (just downloaded it today). I will eventually translate this to the licensed version for my employer, but I was trying a proof of concept before I worried about that.

Is this the right way to configure the handler for this event? Any help would be greatly appreciated.

Thanks again for the great work!
Puño de la estrella del Norte
Top achievements
Rank 1
 answered on 25 Sep 2012
1 answer
748 views
I have a models
Route:
int RouteID;
String RouteName;
IEnumerable<RouteCustomer> Customers;

RouteCustomer:
int RouteID;
int CustomerID;
int Sun;
int Mon;
int Tue;
int Wed;
int Thue;
int Fri;
int Sat;

Customer:
int CustomerID;
String Name;

I have created an edit form that allows changes (route name) and a grid for the customer information.  What is happening now is that I am not getting the events I need when adding a new row to the grid:

Here is the grid code:
@(Html.Kendo().Grid<LightRouteDB.RouteCustomer>()
            .Name("CustomerGrid")
            .Columns(cols =>
                {
                    cols.Bound(r => r.CustomerID);
                    //cols.Bound(r => r.Customer.CustomerName);
                    cols.Bound(r => r.Sun);
                    cols.Bound(r => r.Mon);
                    cols.Bound(r => r.Tue);
                    cols.Bound(r => r.Wed);
                    cols.Bound(r => r.Thu);
                    cols.Bound(r => r.Fri);
                    cols.Bound(r => r.Sat);
                    cols.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
                })
                .ToolBar(toolbar => toolbar.Create())
                .Editable(editable => editable.Mode(GridEditMode.InLine))
                .Pageable()
                .Sortable()
                .Scrollable()
                .DataSource(ds => ds
                    .Ajax()
                    .Events(events => events.Error("error_handler"))
                        .Model(m => { m.Id(p => p.RouteCustomerID); m.Field(f => f.RouteID).DefaultValue(Model.Route.RouteID); })
                    .Create(a => a.Action("CreateCustomerRow", "Routes"))
                    .Read(r => r.Action("ReadCustomerRows", "Routes"))
                    .Update(u => u.Action("UpdateCustomerRow", "Routes"))
                    .Destroy(d => d.Action("DestroyCustomerRow", "Routes"))
                )
          )
And here is the controller:
public ActionResult ReadCustomerRows(int id, [DataSourceRequest] DataSourceRequest request)
       {
           return Json(getRouteCustomersFromSession().ToDataSourceResult(request));
       }
 
       [AcceptVerbs(HttpVerbs.Post)]
       public ActionResult CreateCustomerRow(int id, [DataSourceRequest] DataSourceRequest request,  RouteCustomer customer)
       {
           if (customer != null && ModelState.IsValid)
           {
               IList<RouteCustomer> rc = getRouteCustomersFromSession();
               rc.Add(customer);
           }
 
           return Json(new[] { customer }.ToDataSourceResult(request, ModelState));
       }
 
       [AcceptVerbs(HttpVerbs.Post)]
       public ActionResult UpdateCustomerRow([DataSourceRequest] DataSourceRequest request, RouteCustomer customer)
       {
           if (customer != null && ModelState.IsValid)
           {
               IList<RouteCustomer> rc = getRouteCustomersFromSession();
               var target = rc.Where(c => c.RouteCustomerID == customer.CustomerID).First();
               if (target != null)
               {
                   target.CustomerID = customer.CustomerID;
                   saveRouteCustomersToSession(rc);
               }
           }
 
           return Json(ModelState.ToDataSourceResult());
       }

The events in the controller just don't seem to fire.  I thought I copied it from the sample programs, but it doesn't seem to work correctly.  Any help would be appreciated.
John
Top achievements
Rank 1
 answered on 25 Sep 2012
0 answers
87 views
Does anyone know how to add tooltips for EACH "InsertHtml" item?  Example: I want something like this.


    $(document).ready(function () {
        $("#editor").kendoEditor({
            tools: [
                "bold",
                "italic",
                "underline",
                "strikethrough",
                "fontName",
                "fontSize",
                "foreColor",
                "backColor",
                "insertHtml",
            ],
            insertHtml: [
                { text: "Request.FirstName", value: "#Request.FirstName#" toolTip: "Inserts users first name" },
                { text: "Request.BirthDay", value: "#Request.BirthDay#" toolTip: "Inserts users date of birth" }
            ]
        });
    });
Kevn
Top achievements
Rank 1
 asked on 25 Sep 2012
2 answers
140 views
Edit: I have a typo in the thread title, it should be "Remote view..." not "Remove".   

I am writing a mobile web app that leverages the Kendo UI Mobile 'Application' object.  In one part of the application I am walking a user through selecting a vehicle (year first, then make, then model, etc).  Each of these selections is on it's own page.  Each list is retrieved from a back-end service.  The 'make' depends on the 'year' selected, and the 'model' depends on 'year' and 'make'.  I had built a small utility function that would parameterize the URL I send to the Kendo application's navigate() method and it was working great on version 2012.2.710.  However, in another area I ran into this bug (http://www.kendoui.com/forums/framework/mvvm/bug-nested-array---source-binding.aspx) and was forced to upgrade to 2012.2.913.  This fixes the bug but now there's some code in the navigate() method that strips of any query parameters from the url.  

So, I was doing this:
app.navigate('/Home/SelectMake?year=2012');

and now (version 913) Kendo ends up basically doing this:

app.navigate('/Home/SelectMake');
 
So my question is this: Is there a recommended way to load remote views with parameters?  If not, why was the code added that strips the query parameters when navigating (as this breaks my code now)?

Thanks.
Jeremy Wiebe
Top achievements
Rank 1
 answered on 25 Sep 2012
4 answers
268 views
I have found that if you put a paginated grid with auto height in the panelbar, when you change pages and the grid height changes, the panelbar doesn't keep up with the grid size changes. I suppose I could maybe detect when the grid page changes and somehow refresh the panel its in to fit maybe?
Chris
Top achievements
Rank 1
 answered on 25 Sep 2012
0 answers
139 views

<div>
<form name="form" >
<input type="text" name="msg" value="Your message"/>
<input id="btnsumbit" type="submit" />
</form>
</div>
<div>
<iframe id="guestFrame1" name="guestFrame1" width="500px" height="150px" frameborder="1"   src="http://localhost/kendosample " >
</
iframe>
</div>
<script>
var win = document.getElementById("guestFrame1").contentWindow           
document.forms.form.onsubmit = function ()
{
win.postMessage(this.elements.msg.value, "*")
return false
}
</script>
Please let me know, how to apply the above same logic in kendo window

Prakash
Top achievements
Rank 1
 asked on 25 Sep 2012
0 answers
81 views
Hallo,

have i the chance to set the Field Name of a Grid.Column at runtime? 
Like this:

$("#grid").kendoGrid
   ({
    dataSource:
    {....
        columns:
        [{
            field:"ReadData.php?DataToRead=LastName"
            width: 90
        }]
    }
})

Howard
Howard
Top achievements
Rank 1
 asked on 25 Sep 2012
1 answer
523 views
I'm asking this question again after spending additional hours trying to get this to work without success.   I have a Grid using Ajax binding to display a dropdown list of items in a grid from a collection in the model.    The items are on the server in a List<SomeItems> collection.      This list is not in the model the grid itself is bound to - it is coming from a separate source.    I'm really tired of mucking around with something that is very easy to do in every other tool kit I've ever used.   

My code currently looks like this.   I get no drop down list in my grid at all.  I get an edit box.
@(Html.Kendo().Grid<Models.AutomationDevicePartsMapping>()
       .Name("GridAutomationDevicePartsMapping")
       .Columns(columns =>
                    {
                        columns.Bound(p => p.QuantityMultiplier).Title("Quantity");
                        columns.Bound(s => s.PartNumberName)
                            .Width(300)
                            .ClientTemplate(Html.Kendo().DropDownList()
                                                .Name("PartNumberxyz")
                                                .Events(ev => ev.Change("AutomationDeviceMappingDDLChanged"))
                                                .BindTo(ViewBag.MeterParts)
                                                .DataTextField("Text")
                                                .DataValueField("Value")
                                                .HtmlAttributes(new {style = string.Format("width:{0}px", 200)}).ToClientTemplate()
                                                .ToHtmlString()
                            );
                    })
       .ToolBar(toolbar => toolbar.Create())
       .Editable(editable => editable.Mode(GridEditMode.InLine))
       .Pageable()
       .Sortable()
       .Scrollable()
       .Selectable(s => s.Mode(Kendo.Mvc.UI.GridSelectionMode.Single))
       .DataSource(dataSource => dataSource
                                     .Ajax()
                                     .Model(model => { model.Id(p => p.AutomationDeviceId);
                                     model.Field(p => p.PartNumberName).Editable(false);
                                     })
                                     .Create(update => update.Action("CreateNewAutomationDevicePartsMap", "AutomationDevice").Data("AutomationDeviceID"))
                                     .Read(read => read.Action("GetAutomationDeviceMaps", "AutomationDevice").Data("AutomationDeviceID"))
                                     .Update(update => update.Action("UpdateAutomationDevicePartsMap", "AutomationDevice"))
                                     .PageSize(50)
       )
 
       )
Vladimir Iliev
Telerik team
 answered on 25 Sep 2012
10 answers
411 views
This only happens in IE 9. I'm using the kendo silver style.  I have a custom action in a grid.  On mouseover and mouseout, the grid body height expands (right above the footer, but below the scrollbar).  The template for the custom button also seems to remove the filtering options for the other columns.

Here it is in action (if you use IE 9!):
http://jsfiddle.net/xeyaT/

Do you guys have any idea why or how this might happen?
Nick
Top achievements
Rank 1
 answered on 25 Sep 2012
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
SPA
Filter
Drawing API
Drawer (Mobile)
Globalization
Gauges
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
Popover
DockManager
FloatingActionButton
TaskBoard
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?