Telerik Forums
Kendo UI for jQuery Forum
1 answer
561 views
Is the default behavior for the grid to remove row before firing the remove event?  If so is there a beforeRemove event I can use?

I'm trying to implement my own confirm, for deleting.  I have seen some of the other examples on here but I would prefer to write as little
custom code as possible since there will be a lot of grids in my project that will all use this functionality.

so far I have this
 $kendoGrid.bind("remove", gridRemoveRow);

 var gridRemoveRow = function (e) {
                e.preventDefault();
                app.showMessage("Are you sure you want to delete this row?", "Delete Row", ["Yes", "No"]).then(function (result) {
                    if (result == "Yes") {
                        $kendoGrid.dataSource.remove(e.model)
                        $kendoGrid.dataSource.sync()
                    }
                    else
                        $kendoGrid.cancelChanges();
                });
            };

This code works, but the behavior of removing the row before it gets to gridRemoveRow  could cause some confusion for the user with thinking they clicked the wrong row or that the delete already happened.
Kiril Nikolov
Telerik team
 answered on 24 Oct 2013
1 answer
220 views
Hello There,

We are using Kendo UI Mobile Scrollview for switching pages by swiping left or right. The only problem is that, the "vertical scrollbar" remains on the same position when a page is switched. We want to reset the vertical scrollbar to top when a new page is switched. We have tried using "$("#scrollSection").data("kendoMobileScrollView").refresh()", but it doesn,t work.  

It would help us huge, if there is any workaround for this issue.

Regards.
Petyo
Telerik team
 answered on 24 Oct 2013
1 answer
306 views
Hi,

As a part of client requirement our team needs to use Kendo Calendar while highlighting few dates. Further user should not be able to navigate to any other month/year (which is done through min/max). Moreover, when user clicks on the header part (link displaying the month info e.g. October 2013)  a different view gets displayed. We are trying to disable (still display) this header link at top but to no avail (refer screenshot attached).

Can you guide how can this be achieved?

Thanks,
Prasad
Dimiter Madjarov
Telerik team
 answered on 24 Oct 2013
1 answer
73 views
Using the following code...

<input id="${Statistic.Name}-size"
    type="number"
    value="30"
    class="dark"
    style="width: 100px; float: left;"
    data-bind="value: Measurement"
    data-role="numerictextbox"
    data-decimals="5"
    data-step="0.001" />
<h1 data-bind="text: Statistic.Name"></h1>
The numeric text box is formatted exactly how I want, but if I type in "0.005", then I click somewhere else, the text box changes to "0.01".

However if I click on it again, it changes back to 0.005, and then back to 0.01 when I click elsewhere.
Georgi Krustev
Telerik team
 answered on 24 Oct 2013
4 answers
516 views
I'm not using data binding in my app, but want to be able to know when a user taps on an item in the listview and have it call a function.

Is this possible?  If it isn't, I'm willing to do unnatural things to make it possible.  Where should I look in the code?

Sure, I could just use jquery to add an event but that doesn't work well with the special "tap" and "tap-end" events you have in there.  So, to be more specific I want to be able to know when a user tapped using your built in Touch event support so that I don't have to wait 300ms for the click event to fire off.

thanks,

-Bruce 
Bruce
Top achievements
Rank 1
 answered on 24 Oct 2013
9 answers
1.2K+ views
Hello,
I create a new record when the button "Add new Record" is clicked, it creates a new record but I then need the focus to be on the second column. My first coulmn as the checkboxes and the next column is UPC.. so when the new row is created in a  grid the focus should be on the second column of the grid.

Here is my code:

<table>
<tr class="spaceUnder">
<td> <button id="idAddComplexRecord" onclick="CustomAddButtonComplexRecord(this)" class="ui-submit k-button" style="height:23px; width:150px; padding-left:0px; padding-right:0px; padding-bottom:0px; padding-top:0px; align-content: center">
<img src="Images/add15-1.png" style="height:10px; padding-top:0px;" title="Add a new Record" alt="Add a new Record"/>&nbsp; Add New Record
</button>
<button id="idDeleteComplexItems" onclick="CustomDeleteButtonComplex(this)" class="ui-submit k-button" style="height:23px; width:75px; padding-left:0px; padding-right:0px; padding-bottom:0px; padding-top:0px; align-content: center">
<img src="Images/delete15.png" style="height:10px; padding-top:0px;" title="Delete Item" alt="Delete Item"/>&nbsp; Delete
</button></td>
</tr>
</table>
<div >
@(Html.Kendo().Grid<SurveyMaintenance.Models.SurveyComplexItemDetail>()
.Name("idComplexGridSurveyItems")
.HtmlAttributes(new { ID = "idComplexGridSurveyItems", Class = "k-grid-header" })
.Columns(columns =>
{
columns.Bound(p => p.ItemSelected).ClientTemplate("<input type='checkbox' class='chksvycomplexitem' #= (ItemSelected === true) ? checked='checked' : '' # onclick='SurveyComplexFunctions.toggleComplexItemSelection(this)' />")
.HeaderTemplate("<input type=\"checkbox\" id=\"toggleAllComplexItems\"/>").Width(40);
columns.Bound(p => p.UPC).Width(100);
columns.Bound(p => p.Brand).Width(100);
columns.Bound(p => p.ShelfTagDesc).Width(100);
columns.Bound(p => p.CasePack).Width(60);
columns.Bound(p => p.UnitSize).Width(60);
columns.Bound(p => p.ComplexDetailID).Title("").ClientTemplate("<input id='Find' type='button' name='Find' style='display:inline; width:100px; border-style: inset; padding:0; height:100%;' value='Find UPC'; onclick='FindComplexUPCItem()' /> ").Width(100);

})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Scrollable()
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Events(events => events.Error("grid_error_handler"))
.Read(
read => read.Action("GetSurveyItems", "Survey").Data("SurveyComplexFunctions.additionalData")

)
.Model(model =>
{
model.Id(p => p.ComplexDetailID);
model.Field(p => p.ComplexDetailID).Editable(false);
})
 
)
)
</div>

function CustomAddButtonComplexRecord(e) {
var complexGrid = $('#idComplexGridSurveyItems').data('kendoGrid');
var dataSource = complexGrid.dataSource;
dataSource.insert({ ItemSelected: false, UPC: '', Brand: '', ShelfTagDesc: '', CasePack: '' , UnitSize: '', ComplexDetailID: 0});


}
Traci
Top achievements
Rank 1
 answered on 23 Oct 2013
3 answers
116 views
Hi,

i tried to create one of your examples standalone. But I get this error:

In the script on this page an error occurred.

Row: 3
Character: 23238
Error: Member not found
Code: 0
URK: file://linnup/windemo/data/jquery.min.js

What could be the problem?  Thanks
Best Regards
Rebe
Andrea
Top achievements
Rank 1
 answered on 23 Oct 2013
1 answer
117 views
Hello,

I am using the Autocomplete control with a text input. Users can enter characters in two ways, either directly type it in or use an on screen keyboard and click on keys to inserts characters in the text input control (multi-language keyboards). When I type the characters directly in the textbox the autocomplete works fine and displays the list of characters. 

In the on screen keyboard mode, I trigger both Keypress and Keydown events for the input control by clicking on each key on keyboard picture and pass the characters through those events. As a result the characters appear correctly and I even can see that autocomplete is triggered and queries the server and obtains a list of words but the list never shows up and there is no dropdown.

Here is the function I use to insert characters by passing character code:
function addcharto(code) {
    var control = $('#SearchWord');
    var ed = $.Event("keydown");
    var ep = $.Event("keypress");
    ed.which = code;
    ep.which = code;
    control.trigger(ed);
    control.trigger(ep);
}
I used both events to make sure I am covering every possibilities.
Could you let how can I force the autocomplete to display the list of choices that it is obtained?

Thanks
Ron
Kiril Nikolov
Telerik team
 answered on 23 Oct 2013
1 answer
157 views
I have the requirement to load a set of data in kendo grid editable cell in a dropdown list. The model which I have used to populate the
kendo grid Sales and the model that will be used for the dropdown is resource.

I have added the client template to the resource field


columns.Bound(p=> p.Resource).ClientTemplate("#=Resource.DisplayName#").Width(150);

model.Field(p=> p.Resource).DefaultValue(ViewData["defaultCategory"] as FOO.Models.ResourceModel);

 
But the above lines shows converting type error in view itself.

I have followed the procedures in the below link
http://demos.kendoui.com/web/grid/editing-custom.html

I have my view, controller code below. Can anyone help me out how to solve this.. or is there any other way is there to populate the kendo dropdown
in the kendo grid cell ?

View
  @(Html.Kendo().Grid<FOO.Models.Sales>()
    .Name("SalesGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.ID);
        columns.Bound(p =>p.Resource).ClientTemplate("#=Resource.DisplayName#").Width(150);
        columns.Bound(p =>p.Customer).Width(150);
        columns.Bound(p => p.GS).Width(150);
        columns.Bound(p =>p.Price).Width(150);
    })
    .Scrollable()
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .HtmlAttributes(new { @style = "Font:12px calibri; " })
  .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("GetSaleDetailsByID", "Sales")
        .Data("GetSaleByID")
        )

        .ServerOperation(false)
        .Model(model =>
        {
           model.Id(p => p.Resource);
            model.Field(p =>p.Resource).DefaultValue( ViewData["defaultCategory"] as FOO.Models.ResourceModel);
            model.Field(p => p.Customer);
            model.Field(p => p.GS).Editable(false);
            model.Field(p => p.Price);
     })
    )
    )
Controller
public ActionResult AppointmentSales()
        {
            PopulateCategories();
            var id = RouteData.Values["id"];
            EditSales oresult = new EditSales();
            ViewData["appid"] = "";
            if (id != null)
            {
                oresult = GetSalesDetails(id);
                ViewData["appid"] = id;

            }
            return View(oresult);
        }

CODE FOR POPULATING THE VIEW DATA
private void PopulateCategories()
        {
         
            var categories = _Sales.GetEmployees()
                        .Select(c => new ResourceModel
                        {
                            ID = c.ID,
                            DisplayName =c.DisplayName
                        })
                        .OrderBy(e => e.ID);
            ViewData["categories"] =categories;
            ViewData["defaultCategory"]= categories.First();
        }
 
I have tried to populate a dropdown list box in kendo grid with the example given in kendo demos “Editing Custom editor”. But its not
working , it shows error in the view itself in the following set of line

            model.Field(p =>
p.Customer).DefaultValue(ViewData["defaultCategory"] as FOO.Models.ResourceModel);

and the error is
                Cannot Convert from FOO.Models.ResourceModel to string

Can anyone help me out what is the mistake in the code ?

 Mayil.M
On Behalf of
Jeremy Thompson

 
Petur Subev
Telerik team
 answered on 23 Oct 2013
1 answer
485 views
I have been looking through the postings but can't find one that addresses by specific issue.  I have a grid that is being loaded with data just fine on the initial page request.  But now the user wants to select a subset of the data.

Here is the grid HTML helper from the MVC razor view page:

@(Html.Kendo().Grid<AdvisorSearchResultsVM>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(a => a.AdvisorID);
columns.Bound(a => a.CIFID);
columns.Bound(a => a.FirstName);
columns.Bound(a => a.LastName);
columns.Bound(a => a.Status);
})
.Sortable()
.Pageable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("onError"))
.Model(model =>
{
model.Id(a => a.AdvisorID);
                                model.Field(a => a.AdvisorID).Editable(false);  
})
                            .Read(read => read.Action("GetAdvisors","Advisor"))
)
)

I want to change the grid datasource action to call the Advisor controller GetRegistered method.

I tried doing this in a javascript method

$("#Grid").kendoGrid.dataSource.transport.options.read.action("/Advisor/GetRegistered");

But I get an error that says  $(...).kendoGrid.dataSource is undefined.

Any suggestions?
Daniel
Telerik team
 answered on 23 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?