Telerik Forums
Kendo UI for jQuery Forum
3 answers
614 views
Hello!

I am working on grid that contains user account data.  We want to allow an administrator to change the password for a given user, however, a simple change of the password is undesirable.  We want to pop up a window to allow the change to occur.  This option should _only_ be available on the row currently being edited.  I have found that I can place a button in a column through the use of the ClientTemplate.  I chose a button over a hyperlink since I read I can enable/disable the button, and have set the button to be disabled by default.  Unfortunately, when I hook into the Edit event to call the javascript, I cannot pull the button out of the <td>

Here is the grid definition:

<div id="topGrid">
@(Html.DashboardGrid<DashBUserViewModel>(svm) //GirdName, Export Method Name, Controller Name, add new class, edit template
.Columns(columns =>
{
columns.Bound(x => x.Id).Hidden(true);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(svm.cRUDColSize);
columns.Template(p => { }).ClientTemplate("<a onclick=OnSingleChange('#=Id#')>Assign Role</a>").Width(svm.cRUDColSize);
columns.Template(p => { }).ClientTemplate("<button class='myClass' disabled onclick=ChangePassword('#=Id#')>Change Password</button>").Width(svm.cRUDColSize);
// REMOVED FOR BREVITY
.Events(events => events.Cancel("showAdd").Edit("editRow").Save("showAdd")) // to blank out the template text to avoid issues
)
</div>


Here is the javascript method (the enable() method is undefined):

function editRow(currentRow) {
// Hide the add button to prevent weird errors
this.wrapper.find(".k-grid-add").hide();

if (currentRow.model.isNew()) {
currentRow.container.find("td:eq(2)").text("");
}

currentRow.container.find("td:eq(3)").enable();
}

Does anyone know how to get the button and set it to enabled?

Much thanks,

Andrew Giles

Dimiter Madjarov
Telerik team
 answered on 21 May 2014
1 answer
5.4K+ views
Hi, Can anyone please let me know how we can write our own function for sorting when the column header is clicked. And do we need to write two function for asc and desc? Any help appreciated!
Dimiter Madjarov
Telerik team
 answered on 21 May 2014
5 answers
300 views
When I click a data-role="backbutton" button and move just a little bit as I click, the BackButton navigates back but the attached click event calling my code does not fire.

Steps to reproduce:
http://plnkr.co/edit/XzaXgNzODJqgqdVHANKb?p=preview

1. Click on the Find tab control entry (2nd one on the bottom)
2. Click on the Filter button in top right hand corner
3. Click on the "Floors" item (next to last)
4. Click on a few floors.  Check box will be displayed on right.
5. Click on the "Filter" button in top left hand to go back to Filter view.
6. When back on the "Filter" view it "should" show the number of floors selected.

In step 5 above, if you drag a little bit when you click the back button will fire but the attached click event calling my code is not fired and the number of floors selected will not be displayed properly on the "Filter" view.

I have recorded a video of this plunker recreating the problem on an iPad Air:
http://youtu.be/fJmgikqhdEQ










Kiril Nikolov
Telerik team
 answered on 21 May 2014
1 answer
142 views
Hi, I have an application which has a huge amount of data to be loaded into Kendo grid. I am using web forms(aspx). Since I need to download some thousands of rows into grid, I am trying to load the data from database by giving the page size.

I want the sort to be done for all the rows, but for my code, sorting is done only for those 2000 rows in the current view.

Can anyone please let  me know which is the good way to do serversorting and serverpaging with lot of data in the database that should be loaded into the kendo grid.

Thanks in advance!

Here is my code:
 Dim get_data As String = "select fname, lname, address, phnum from contacts limit  " & limit & ", 2000"

'limit here is taking the page numberr
          Dim JSON_result As String = "["
          'get the data from DB and make it a JSON string
 
          Dim connection1 As New MySqlConnection(constr)
          connection1.Open()
          Dim get_Command As New MySqlCommand(get_data, connection1)
          Dim reader As MySqlDataReader = get_Command.ExecuteReader()
          While reader.Read()
 
              Dim FirstName As String = reader("fname").ToString()
              Dim LastName As String = reader("lname").ToString()
              Dim address As String = reader("address").ToString()
              Dim phnum As String = reader("phnum").ToString()
             
 
              JSON_result += "{""First Name"":""" & FirstName & """, ""Last Name"":""" & LastName& """, ""Address"":""" & address & """, ""contact"":""" & phnum& """},"
          End While
          JSON_result = JSON_result.Remove(JSON_result.Length - 1)
          JSON_result += "]"

And my front end looks like:

var grid = $("#gridAllRuns").kendoGrid({
                       dataSource: {
                           type: "json",
                           transport: {
                               read: url_load
                           },
                           schema: {                               
                               total: function (response) {
                                   return 43658;
                               }
                           },
                           serverPaging: true,
                            
                           pageSize: 2000
                       },
                       dataBound: onDataBound,
                       height: $(document).height() - 250,
                       groupable: true,
                       sortable:true,
                       reorderable: true,
                       //selectable: "multiple",
                       resizable: true,
                       pageable: true,
                      
                          filterable: {
                           extra: false,
 
                           operators: {
                               string: {
                                   eq: "equal to",
                                   startswith: "starts with",
                                   neq: "not equal to"
                               }
                           }
                       },
                       toolbar: kendo.template($("#template").html()),
                       columns: [
                           { title: "First name", field: "First Name"},
                           { title: "Last name", field: "Last Name" },
                           { title: "Address", field: "Address" }]
            }



Daniel
Telerik team
 answered on 21 May 2014
1 answer
87 views
We are using Kendo UI Controls and its Validations.

Now the problem is the Kendo validations are not working in manner like MVC validations.

I want to know how to get kendo validation working like the way Classic MVC validations works.

Following is the scenario which I would like to achieve by either of ways.

--- Kendo UI Validation raise popup beneath the controls whenever validations occurs. And I don't want required field error message like tool tip or popup.

I want to have simple red border around the control (drop-down list or text box) if I m not selecting any item from drop-down list and submit the button.

So I want to avoid that popup/tooltip situation whenever validations fires.
Daniel
Telerik team
 answered on 21 May 2014
2 answers
86 views
I'm developing our first Kendo Mobile app and run into an issue with Safari in iOS7. 

When I perform a $.ajax request (see below) to verify the usercredentials, the iPhone/iPad Network Activity Indicator starts spinning and does not stop. The indicator even keeps spinning after I shutdown webpage with the Kendo app. I have to remove the websitedata via the Settings menu to stop the Indicator from spinning.

          var request = $.ajax({
            url: webapiEndpoint() + '/authenticate/login?' + urlParameters,
            type: 'GET',
            contentType: "application/json",
            data: '',
            dataType: 'json',
            processData: false
         });

         request.done(function ( data ) {
            app.navigate(activePage);
         });

         request.fail(function ( error ) {
            app.navigate(loginPage);
         });

The $ajax request receives the correct response from the WebApi and shows the appropriate page. Are you aware of any issue with iOS7 Safari that causes this strange behavior? Other $.ajax requests result in the same issue, so it is not this specific request that is causing the problem.









Remco
Top achievements
Rank 1
 answered on 21 May 2014
1 answer
270 views
Using Kendo UI Mobile, what is the best way to allow a user to specify a duration such as an hour and thirty minutes.  I would like to give them something similar to the time form input but without the AM/PM designation.  Is this possible or is there a better way?

Thanks
Kiril Nikolov
Telerik team
 answered on 21 May 2014
5 answers
223 views
Hi ,

1)
When I set the Width of AutoSelect  in below demo for State filed;  it does also changing auto search filter  on column. Can you guys please suggest a solution.
And Autoselect for State field width not looking same in all browsers. In IE9 Autoselect width looks similar to  all other fields in the form. But when we take it on Chrome "State" field looks much bigger.

2) And also can you help in validating Autoselect  for State field.I   am trying to clear the Autoselect field when non existing datavalue is typed in the State field but that is not working. Can you please help.
//create AutoComplete UI component
                      $("#State").kendoAutoComplete({
                          dataTextField: "text",
                          dataValueField: "value",
                          open: function (e) {
                              valid = false;
                          },
                          select: function (e) {
                              valid = true;
                          },
                          close: function (e) {
                              // if no valid selection - clear input
                              if (!valid) this.value('');
                          },
                          dataSource: autoCompleteStates,
                          placeholder: "Select States..."
                      });
Note: Demo doesn't have Scripts (Kendo/Js) included.

Thanks,
Chatrapathi Chennam
Petur Subev
Telerik team
 answered on 21 May 2014
1 answer
501 views
Hello,

This error is happening quite frequently across all three browsers on a ASP.NET MVC Kendo Grid we use. I attempted to wrap any javascript functions we wrote that interact with the kendo controls in document ready but it did not make any difference. Sample code is below:

@Html.HiddenFor(m => m.CustomerTypesQuery)
                @(Html.Kendo().Grid<SelectListItem>()
                        .Name("CustomerTypes")
                        .HtmlAttributes(new { style = "width: 100%; height: 165px;" })
                        .Columns(columns =>
                                        {
                                            columns.Bound(p => p.Value).Hidden();
                                            columns.Bound(p => p.Text).Title("Customers");
                                        })
                        .Scrollable()
                        .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
                        .DataSource(dataSource => dataSource
                                                              .Ajax()
                                                              .Read(read => read.Action("ReadCustomerTypes", "Search"))
                                                              .Model(m => m.Id(p => p.Value))
                      )
                        .Events(events => events.Change("CustomerTypesChange").DataBound("CustomerTypesDataBound"))
                )

                <script type="text/javascript">
                    function CustomerTypesChange() {
                        var grid = $('#CustomerTypes').data('kendoGrid');
                        var rows = grid.select();
                        $('#CustomerTypesQuery').val('');
                        rows.each(
                            function () {
                                var record = grid.dataItem($(this));
                                $('#CustomerTypesQuery').val($('#CustomerTypesQuery').val() + record.Value + ",");

                            }
                        );
                        $('#CustomerTypesQuery').val($('#CustomerTypesQuery').val().replace(/,$/, ''));
                         //posts a form to the server
                         submitAjaxForm();
                    }

                    function CustomerTypesDataBound() {
                        filterHiddenFieldDataBound.call(this, 'CustomerTypesQuery');
                    }

        //wrapping any fo these interactions wit document ready does not help
        var filterHiddenFieldDataBound = function(hiddenfield) {
        var hiddenfieldId = '#' + hiddenfield;
        var grid = this;
        var dataSource = this.dataSource;
        var matchedItems = new Array();
        var value = $(hiddenfieldId).val();
        if (value) {
            $.each(value.split(','), function() {
                var item = dataSource.get(this);
                if (item) {
                    var row = grid.tbody.find('[data-uid=' + item.uid + ']');
                    row.addClass('k-state-selected');
                    matchedItems.push(this);
                }
            });
            $(hiddenfieldId).val(matchedItems.toString());
        }
    };
 </script>

I attempted to wrap functions that called the .value() method of kendo in document ready as per http://www.telerik.com/forums/cannot-call-method-%27value%27-of-kendodropdownlist-before-it-is-initialised-error#dhl__nLrG0GvjpwmSeI5PQ but this did not help
We are using kendo version 2014.1.318 but even attempting to upgrade to  2014.1.416 did not fix this issue. I know this is a kendo grid example but the error is being thrown on the kendo drop down list component of the kendo library so I thought this section would be appropriate.
Georgi Krustev
Telerik team
 answered on 21 May 2014
1 answer
411 views
Hello. 

I'm trying to add a button to upload an image in the grid. The problem is when the row is "saved". All elements of the file are stored, but the byte [] (picture) never reaches the controller.

He conseguido rellenar el grid mediante javascript





But when i try to save, the object received controller is empty in field img



@(Html.Kendo().Grid<InventarioMerlin.Models.ContadorModelo>()
    .Name("GridContadorModelo")
    .Columns(columns =>
    {
        columns.Bound(p => p.id).Visible(false).Width(100);
        columns.Bound(p => p.nombre).Width(100);
        columns.Bound(p => p.isenabled).Width(100);
        columns.Bound(p => p.img).Width(100);
        columns.Command(c => c.Custom("Upload").Click("upload")).Title("Grafica").Width(100);
        columns.Bound(p => p.grafica).Width(100);
        
        columns.Command(command => { command.Edit(); }).Width(200);
    })
                    .ToolBar(toolbar => { toolbar.Create(); toolbar.Save(); })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable(p => p.Refresh(true))
    .Sortable()
    .Scrollable()
    .HtmlAttributes(new { style = "height:100%;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)    
        .Events(events => events
            .Error("error_handler")
            .RequestEnd("onRequestEnd"))
            .Model(model =>
                        {
                            model.Field(p => p.img).Editable(true);
                            model.Id(p => p.id);
                            model.Field(p => p.id).Editable(false);
                            model.Field(p => p.isenabled).DefaultValue(true);
                        })
            .Create(create => create.Action("ContadorModelo_Popup_Create", "Contador"))
            .Read(read => read.Action("ContadorModelo_Popup_Read", "Contador"))
            .Update(update => update.Action("ContadorModelo_Popup_Update", "Contador"))
            //.Destroy(update => update.Action("EditingPopup_Destroy", "Ccoconfiguraciones"))
    )
        )
 
 
 
function upload(e)
    {
         
        e.preventDefault();
        rowSelected = this.dataItem($(e.currentTarget).closest("tr"));
       
        $('#myModal').modal({
            show: true
        })
 
        
    }
 
 $("#btnSaveChanges").click(function () {
        refreshGrid();
        $('#myModal').modal('hide');
    });
 
 
function refreshGrid()
    {
        var grid = $("#GridContadorModelo").data("kendoGrid");
        var dataSource = grid.dataSource;
        var data = dataSource.data();
        $.each(data, function (index, rowItem) {
            if (rowItem.id == rowSelected.id) {
                rowItem.img = imageUploaded;
                rowSelected.dirty = true;
            }
        });
        grid.refresh();
         
    }


Daniel
Telerik team
 answered on 21 May 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Drag and Drop
Map
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
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
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?