Telerik Forums
UI for ASP.NET MVC Forum
1 answer
254 views
We are trying to render a NumericTextBox in a Kendo grid. But the trick to lookup the id with javascript is not working. Can anyone help?

My code:
MVC View:
            @(Html.Kendo().Grid(Model.BeginVoorraadModel.Rows)
            .Name("Begingrid")
            .Columns(columns =>
            {
                columns.Bound(p => p.Totaalgewicht).Title("Totaalgewicht<br/>(kg)").ClientTemplate(
                    Html.Kendo().NumericTextBox()
                    .Name("BeginVoorraadModel.Rows[#= index('Begingrid', data)#].Totaalgewicht")   <== here is the problem!
                    .Culture("nl-NL")
                    .Decimals(2)
                    .HtmlAttributes(new Dictionary<string, object> { { "value", "#=Totaalgewicht#" }, { "class", "numTextBox" } })
                    .ToClientTemplate().ToHtmlString());

                columns.Bound(p => p.Omschrijving).Title("Omschrijving");
                columns.Bound(p => p.Stikstof);
                columns.Bound(p => p.Ureum);
                columns.Bound(p => p.Fosfaat);
                columns.Command(c => { c.Custom("Del").Click("onRemove"); });
            })
            .ToolBar(toolbar =>
            {
                toolbar.Create().Text("Toevoegen");
            })
            .Editable(edit => { edit.Mode(GridEditMode.InCell); edit.CreateAt(GridInsertRowPosition.Bottom); })
            .Resizable(resizing => resizing.Columns(true))
            .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(false)
                .Model(model =>
                {
                    model.Id(p => p.Id);
                    model.Field(p => p.Totaalgewicht).Editable(false);
                })
                .Read(r => r.Action("ReadBeginVoorraad", "Kunstmest"))
                .Destroy(r => r.Action("DeleteBeginVoorraad","Kunstmest"))
            ) 

Javascript:
function index(grid, dataItem) {
    var data = $('#' + grid).data("kendoGrid").dataSource.data();

    return data.indexOf(dataItem);
}

Thnx!
Nikolay Rusev
Telerik team
 answered on 09 Sep 2014
1 answer
322 views
Dear Telerik Support Team,

I would like to know if it is possible to batch delete and update of selected rows by the external buttons. 
If yes, Could you please provide the sample code?  

Scenario is

I have a multiple rows selectable grid, "Delete Selected Items" button and "Assign DataOwner" button in my View.

If User click on "Delete Selected Items" button then the selected rows will get deleted
If User click on "Assign DataOwner" button then the selected rows Owner column will get updated as DataOwner. 
Calvin
Top achievements
Rank 1
 answered on 09 Sep 2014
1 answer
280 views
I'm getting an javascript error when trying to filter the scheduler using a Guid from a dropdownlist.  I had a very similar error when filtering by an int.  That was fixed by using parseInt(this.value)  instead of using this.value and then assigning the parseInt to  the filter value like:
var filter = {
                logic: "or",
                filters: [
                    {
                        operator: "eq",
                        field: "AssetID",
                        value: parseInt(this.value())
                    }
                ]
            };
 
Now I'm having the same type of error when the DataValueField of the dropdownlist is a Guid.

I'm doing this:
<div style="margin-left: 30px; margin-bottom: 20px">
    Choose Owner:
    @(Html.Kendo().DropDownList()
          .Name("Owner")
          .DataTextField("DisplayName")
          .DataValueField("UserID")
          .DataSource(ds => ds.Read("TaskUsers", "Users"))
          .Events(events => events.Change("userChange"))
    )
</div>
function userChange() {
 
    var scheduler = $("#scheduler").data("kendoScheduler");
 
    var selection = this.value();
     
    if (selection == "00000000-0000-0000-0000-000000000000") {
        scheduler.dataSource.filter([]);
    }
    else {
        var filter = {
            logic: "or",
            filters: [
                {
                    operator: "eq",
                    field: "AssetID",
                    value: selection
                }
            ]
        };
        scheduler.dataSource.filter(filter);
    }
}

I placed a break point in the code and 'selection' is a valid guid string and it is the guid that I expected it to be.
Can you filter by a Guid?
Edward
Top achievements
Rank 1
 answered on 08 Sep 2014
14 answers
580 views
In your examples,i noticed that the column has a big width,but when editing the column,the texbox is much smaller,so it doesn't rich the end of column limits.how can i do that?

Regards,
Daniel

Dimiter Madjarov
Telerik team
 answered on 08 Sep 2014
1 answer
76 views
Hi All,

Does anyone know if it's possible to check/uncheck the check box elements of the ColumnMenu in the kendo grid from the onDataBound event.
I have a specific requirement when I can't use the columnHide() 

Any help would be greatly appreciated.

Cheers,
Michael
Dimiter Madjarov
Telerik team
 answered on 08 Sep 2014
5 answers
227 views
Hy,

I have implemented js code to expand all child items under the selected NODE item.   And This Works FINE.

Is there a build in way in KEDO Treeview do this ? a better way...I mean.


OnRClickTreeNode()
{
var node = getTreeView().findByUid(getRightClickedItem().uid);
var treeView = getTreeView();
expandNodeChildItemsRecursive(treeView, node);
}

function expandNodeChildItemsRecursive(treeView, node) {
treeView.expand(node);
var childNodes = $(".k-item", node);
for (var i = 0; i < childNodes.length; i++) {
expandNodeChildItemsRecursive(treeView, childNodes[i]);
}
}
Rick Nguyen
Top achievements
Rank 1
 answered on 06 Sep 2014
2 answers
109 views
I am using a NumericTextBox control for entering a credit card number. However, there is a strange bug when this is used in combination with IE11 (I'm unable to test other versions of IE at the moment so I don't know if this is an issue with IE versions > 11).

If I enter 5415240007992185 and tab away from the control it changes to 5415240007992186.
If I enter 5415240007992187 and tab away from the control it changes to 5415240007992188.
If I enter 5415240007992189 and tab away from the control it changes to 5415240007992190.

There is some upper limit where, for whatever reason, all numbers are changed to the next even number when the control loses focus. Here is the markup I'm using for the control:

@(Html.Kendo().NumericTextBox()
    .Name("ccAccountNumber")
    .Decimals(0)
    .Format("{0:#}")
    .Spinners(false)
)
Darryl
Top achievements
Rank 1
 answered on 05 Sep 2014
13 answers
207 views
I have upgraded to Q2 2014 and the install appears to work successfully. When I open my solution in visual studio and try and upgrade my project I get the following error show in attachment 1 when doing from the Telerik Menu option. And when right clicking on the project in the solution explorer there is no longer a telerik menu option to upgrade the kendo in the project.

A fix for would be greatly appreciated.
Momchil
Telerik team
 answered on 05 Sep 2014
7 answers
681 views
Is there a way to configure a combobox and a datasource using MVVM to have an initial value, but if the user starts typing in the box to go to the server and fetch all the remaining items from an MVC controller action that returns a JSON result?

I've tried doing an add to the datasource for the initial item, but that just keeps it from retrieving stuff from the server.  There also doesn't seem to be a built in event that would let me know that the user is trying to search (open doesn't fire if the user tabs in and starts typing unless the text is ALREADY in the data source).  I've also played with serverFiltering, but I just don't seem to have the right combination get what I'm after.  It would seem this is a common scenario where you put some data in a combobox, but avoid bringing down a list of things till a user really needs them.  Considering the number of look ups on  my screen, I do not want to load data for look ups that aren't going to be used by the user. 

In view:
<input id="assetCategoryId" name="assetCategoryId" elite-remaining-field="AssetCategory"
  data-role="combobox"
  data-auto-bind="false"
  data-placeholder="Select a status"
  data-value-primitive="true"
  data-text-field="text"
  data-value-field="id"
  data-bind="value: assetCategoryId, source: assetCategoryList" />

In the viewmodel:
assetCategoryId : 1,
assetCagetoryList:  null;

intialize : function(data) {
    viewModel.set('assetCategoryId', data.assetCategoryId);

    var ds = new kendo.data.DataSource({
           //serverFiltering: true,
           transport: {
          read: {
                url: "/dropdown/AssetCategory",
                dataType: "json"
           }
        }
    }); 

   // ds.add({ id: data.assetCategoryId,, text: data.assetCategoryText});
   viewModel.set('assetCategoryList', ds);
},


I fear that I'm going to have to wire all this up myself:
-- Ditch the datasource and use an array
-- Populate the array with my initial data
-- Tie into the keydown event of the combobox
-- Upon getting a keydown, check the length of the array, if it is 1 or less, go get the rest of my data; otherwise, do nothing.


d




Georgi Krustev
Telerik team
 answered on 05 Sep 2014
1 answer
123 views
Hi,

I am using telerik grid for mvc and I configured it for inline editing



Model Properties:
.......
 public string ErrorText { get; set; }
        public int Order { get; set; }
        public String Operator { get; set; }
..........

For the operator column in the above grid I want to use dropdown list with set of values coming from an enum list. User will select from list of operators and update the row. Could anyone guide me on implementing this.


Kiril Nikolov
Telerik team
 answered on 05 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?