Telerik Forums
Kendo UI for jQuery Forum
6 answers
1.5K+ views
if you set a column filter value and then click filter in the Grid Column Filter Pop, the grid will filter.

If you then manually set the filtered value back to Nothing ("") by deleting the value in the text box and click filter, nothing will happen, and the grid will still be filtered on the previous value. The expected behaviour woudl be for the Grid to be reloaded with no filters when none are specified and the filter button is clicked.

This is mildly inconsistent when using the standard grid filter functionality, and very broken if you are customising the grid filters yourselves and using dropdowns or multiselects as I am.

In order to fix this behaviour,  the following simple change neds to be made to the filter method of the  FilterMenu object in the lastest source.

 
var FilterMenu = Widget.extend(
.
.
.
 filter: function(expression) {
            expression = this._merge(expression);
            if (expression.filters.length) {
                this.dataSource.filter(expression); 
            } else {                               // Add these lines
                this.dataSource.read();          // Add these lines
            }                                      // Add these lines
        },

Any chance this fix or similar could be incorporated into a future build ?
Dimiter Madjarov
Telerik team
 answered on 03 May 2016
5 answers
503 views
Hello

I was wondering how I can achieve dynamic multiple column headers. Currently I have a product followed by six columns , each a pair of Quantity and Price for past three years from selected year. I wish to group each Quantity & Price of each year under a title of the year . See example.

Before the update with multiple headers I as injecting a <tr> rows with javascript after the first table element, but this doesnt export with grid.

Help much appreciated

columns.Group(group => group
.Title("Contact Info") ****** DYNAMIC HOW **** ????
.Columns(info => {
info.Bound(x => x.ContactTitle).Width(200);
info.Bound(x => x.ContactName).Width(200);
info.Group(g => g.Title("Location")
.Columns(location =>
{
location.Bound(c => c.Country).Width(200);
location.Bound(c => c.City).Width(200);
})
);
info.Bound(x => x.Phone);
})
);
Rosen
Telerik team
 answered on 03 May 2016
3 answers
793 views

Hello,

I have this code that can do a partial search on the first name or last name of any rows.

http://jsfiddle.net/EaNm4/520/

$(document).ready(function() {
  var data = [
    {firstName: 'Bob test', lastName: 'Kelso'},
    {firstName: 'abc test', lastName: 'def'},
    {firstName: 'toto test', lastName: 'tata'},
    {firstName: 'foo test', lastName: 'var'},
 
  ];
 
  $("#grid").kendoGrid({
    dataSource: {data: data},
    height: 350,
    columns: ['firstName', 'lastName']
  });
   
  var searchOperator = function(items, filterValue) {
    items = items.toLowerCase();
    var searchText = $('#search').val().toLowerCase().split(/[\s,]+/);
    if (searchText.length) {
        var found = true;
      for(var s in searchText) {
        if (items.indexOf(searchText[s]) == -1) {
          found = false;
          break;
        }
      }
      return found;
     
     
    }
    return true;
  };
   
   
   
  $('#search').on('change', function() {
    var dataSource = $("#grid").data('kendoGrid').dataSource;
    var searchText = $(this).val();
    dataSource.filter({
        logic:"or",
      filters: [{
        field: 'firstName',
        operator: searchOperator
      },{
        field: 'lastName',
        operator: searchOperator
      }]
    });
   
  });
   
});

 

If you type "bob", "bob test", "bo te", or "kel" in the search box, the first rows will stay visible.

As long as you have a partial word, you will get the rows.

But if you search for a word in both cols, like "bob kelso" the row will not be display.

Is there a way to be able to search multiple fields at the same time, so "bob kelso" will display the first rows?

I was thinking maybe of a way that when the datasource is loaded, it will create a new field with all the data of all other rows, so when I do a search like that, I would simply search that field... is there a way to do something like that... or maybe you have a better suggestion?

Thank you

Konstantin Dikov
Telerik team
 answered on 02 May 2016
3 answers
99 views

Hello,

In the exemple: "http://dojo.telerik.com/AReza", how can i set minimum value for menu popup "Show items with value that". column "Units in Stock" i not want the value less than 0.

 

 

Julian
Top achievements
Rank 1
 answered on 02 May 2016
3 answers
132 views

Hello,

We have a grid that maps nested model properties. We have used the schema 'from' option exactly as outlined here: http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/use-nested-model-properties

However this does not work properly if the grid is configured with incell editing. Instead of editing the variable at its original location (as specified by the 'from' option), the grid just creates new dummy variables on the target object with the same name as the schema field. Any edits are then stored into those dummy fields rather than to the original location.

Here is a dojo example that reproduces the issue: http://dojo.telerik.com/eLOpI

If you open the console there is a timer that logs the toJSON() content of the object in the grid. You can see the dummy variables that get created, and whenever you make edits to the object the dummy variables update, but the original nested ones don't.

regards,

Rowan

Alex Gyoshev
Telerik team
 answered on 02 May 2016
3 answers
88 views

I am using inline editing and creating a new record. The record is created by the controller and sent back to the webpage, but the kendo grid is not accepting it. Therefore it does not have the Id, and further edits (before refreshing the page) cause the grid to create another record. It is the same problem from this thread, however following their solution did not fix my issue.

 

Here is my grid/view

@(Html.Kendo().Grid(@Model.contactList)
                        .Name("AgentContactsGrid")
                        .Columns(columns =>
                        {
                            columns.Bound(d =>                  d.TypeId).EditorTemplateName("ContactType").Title("Type").ClientTemplate("#:TypeAsString#").Width("120px");
                            columns.Bound(m => m.Information)
                                .Title("Information");
                            columns.Command(command =>
                            {
                                command.Edit();
                                command.Destroy();
                            }).Width("200px");
                        })
                        .ToolBar(commands => commands.Create().Text("New Contact"))
                        .Editable(editable =>
                        {
                            editable.Mode(GridEditMode.InLine);
                            editable.DisplayDeleteConfirmation("Delete this Contact?");
                        })
                        .Pageable(x => x.Enabled(true))
                        .Events(e =>
                        {
                            e.Save("ContactUpdate");
                        })
                        .DataSource(ds => ds
                            .Ajax()
                            .Create(create => create.Action("CreateContact", "Users")).Read("ReadContact", "Users")
                            .Read(read => read.Action("ReadContact", "Users"))
                            .Update(update => update.Action("UpdateContact", "Users"))
                            .Destroy(destroy => destroy.Action("DeleteContact", "Users"))
                            .Model(model => model.Id(m => m.Id))                       
                            .PageSize(5)
                            .Total(Model.contactList.Count)
                            .Events(events => events.RequestEnd("onRequestEnd"))
                        ))

 

Here is a function I use to set some values, in case it matters (if i can get this to work I won't need it any more)

function ContactUpdate(e) {
        e.model.set("UserId", @Model.userDto.Id);
 
        $.ajax(
        {
            url: "/Users/GetContactTypeById",
            dataType: "JSON",
            data: { id: e.model.TypeId },
            success: function (data) {
                e.model.set("TypeAsString", data.result);
            },
            error: function() {
                e.model.set("TypeAsString", "error");
            }
        });
    }

 

Here is my controller method for creating

public ActionResult CreateContact([DataSourceRequest] DataSourceRequest request, UserContactDto contact)
        {
            //insert the record to the DB
            if (contact != null && ModelState.IsValid)
            {
                contact.Id = _userServices.AddUserContact(contact, CurrentUser.UserId);
            }
 
            //return the updated record which contains the correct model ID
            return Json(new[] { contact }.ToDataSourceResult(request, ModelState));
        }

 

And finally here is an example of what is returned to the page (from network in inspect)

{
  "success": true,
  "result": {
    "data": [
      {
        "userId": 609001,
        "typeId": 405,
        "information": "123-123-1234",
        "typeAsString": null,
        "id": 182
      }
    ],
    "total": 1,
    "aggregateResults": null,
    "errors": null
  },
  "error": null,
  "unAuthorizedRequest": false
}

 

Any help would be appreciated.

Dimiter Topalov
Telerik team
 answered on 02 May 2016
1 answer
369 views

Is it possible to change the color of a specified cell programmatically, after Spreadsheet initialisation? Apologies if there's documentation to this effect, I haven't managed to find it.

E.g. $("#spreadsheet").data("kendoSpreadhseet").activeSheet().range("J2").setState({background: "#000000"})

Alex Gyoshev
Telerik team
 answered on 02 May 2016
1 answer
254 views

We are using Kendo MVVM.  It is easy and straightforward to set the data source for a drop down list to pull from that view model.  However, we cannot update that source and have it reflected in the drop down list.  We can do it for the combobox very easily.  Confused as to why the dropdown list would make it "difficult".  While it isn't technically difficult, it is dirty for the view model to need to access the view element directly in order to call .setDatasource.

Please tell me I am missing something about updating the datasource of a drop down from the view model.

-David

Alexander Valchev
Telerik team
 answered on 02 May 2016
1 answer
308 views

I'm creating a TreeList from remote data that will be defined by the end user and that I won't have control over.  When I receive data from the data source where parentId = 0, no data loads.  When I receive data where parentId = null (for root nodes), the values load successfully.

So...is it required that the parentId value for root nodes be null or is there a flag I can set for the parentId field that says something like "consider nodes whose parentId = 0 to be a root node"?

 

Kiril Nikolov
Telerik team
 answered on 02 May 2016
1 answer
168 views

Hi.

I'm making a "formula creator" in this demo: http://dojo.telerik.com/URuLO/3.

My problem is that I want to be able to sort the list view items too. The drag-drop works fine but it seems they conflict with Sortable in this case. So I can only drag list items to the end of the list and not re-arrange between them.

The question is: Can I use sortable in .k-listview in this case ?

Alexander Valchev
Telerik team
 answered on 02 May 2016
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
Map
Drag and Drop
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
ScrollView
Switch
TextArea
BulletChart
Licensing
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
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?