Telerik Forums
Kendo UI for jQuery Forum
2 answers
278 views
Hello,
we want to use the multiselect in this context:
  • Grid bound to an XML datasource
  • Multiselect bound to an XML datasource
  • Data binding between Grid & multiselect for popup or inline editing
But we can't get the data binding between the grid & the multiselect to work in the case of multiple values.

For instance, when the grid data reads either
<record number="3">
    <nid>3</nid>
    <column1>row3col1</column1>
    <column2>BBBtxt,CCCtxt</column2>
    <mval>BBBval,CCCval</mval>
</record>

or
<record number="4">
            <nid>4</nid>
            <column1>row4col1</column1>
            <column2>BBBtxt,CCCtxt</column2>
            <mval>BBBval</mval>
            <mval>CCCval</mval>
        </record>

The multiselect always remains empty in editing mode, no data binding seems to happen between the grid & the multiselect.

But when the grid data reads:
<record number="2">
            <nid>2</nid>
            <column1>row2col1</column1>
            <column2>AAAtxt</column2>
            <mval>AAAval</mval>
        </record>
Binding between grid & multiselect works.

Could it be that there's something wrong in our datasource or multiselect definition or is there something wrong with the multiselect data binding ?

Here's the code we use:
// JavaScript Document
 
jQuery(document).ready(function() {
 
    // grid
    jQuery("#grid").kendoGrid({
        dataSource: gridDataSource,
        columns: [
            {
                field: "column1",
                title: "Column 1",
                width: "300px"
            },
            {
                field: "column2",
                title: "Column 2",
                editor: multiselect_editor,
                width: "300px"
            },
            {
                command: [
                    {name:"edit",text:{update:"Edit",cancel:"Cancel"}},
                ],
                width:"10%"
            }
        ],
        toolbar: [{name:"create",text:"New"}],
        editable: {mode:"popup"},
        sortable: true,
        pageable: true,
        resizable: true
    });
})
 
//grid datasource
var gridDataSource = new kendo.data.DataSource({
    type: "xml",
    transport: {
        read: function (options) {
                jQuery.ajax( {
                    url: "data/griddata.asp",
                    type: "POST",
                    cache: false,
                    success: function(result) { options.success(result); },
                    error: function(e) { alert(e.responseText); },
                    data: {
                        startrow: ((options.data.pageSize*(options.data.page-1))+1),
                        maxrows: 50
                    }
                });
        },
        update: function (options) {
                alert("updated");
        },
        create: function (options) {
                alert("created");
        }
    },
    schema: {
        type: "xml",
        data: "/root/resultset/record/",
        model: {
            id: "nid",
            fields: {
                nid: "nid/text()",
                column1: "column1/text()",
                mval: "mval/text()",
                column2: "column2/text()"
            }
        },
        total: "/root/resultset/@size"
    },
    error: function(e) {
        alert(e.xhr.responseText);
    },
    serverFiltering: true,
    serverPaging: true,
    serverSorting: true,
    pageSize: 50
})
 
// multiselect for popup editor
function multiselect_editor (container, options) {
    jQuery('<select multiple="multiple" id="multiselect_editor" data-text-field="textnode" data-value-field="valuenode" data-bind="value:mval"/>')
    .appendTo(container)
    .kendoMultiSelect ({
        placeholder: "Select...",
        autoBind: true,
        dataTextField: "textnode",
        dataValueField: "valuenode",
        dataSource: {
            type: "xml",
            serverFiltering: true,
            sort: { field: "textnode", dir: "asc" },
            transport: {
                read: { type: "POST", cache: false, url:"data/multiselectdata.asp"},
            },
            schema: {
                type: "xml",
                data: "/root/resultset/record",
                model: {
                    fields: {
                        textnode: "textnode/text()",
                        valuenode: "valuenode/text()"
                    }
                }
            }
            ,error: function(e) {
                alert(e.xhr.responseText);
            }
        }
    });
}

And the data samples:
  • Grid data
<?xml version="1.0" encoding="utf-8"?>
<root>
    <resultset date="03/09/2013" size="3" time="10:13:50">
        <record number="1">
            <nid>1</nid>
            <column1>row1col1</column1>
            <column2></column2>
            <mval></mval>
        </record>
        <record number="2">
            <nid>2</nid>
            <column1>row2col1</column1>
            <column2>AAAtxt</column2>
            <mval>AAAval</mval><!-- Works for multi select data binding (to set 1 selected item in the multiselect in the editor) -->
        </record>
        <record number="3">
            <nid>3</nid>
            <column1>row3col1</column1>
            <column2>BBBtxt,CCCtxt</column2>
            <mval>BBBval,CCCval</mval><!-- Does not work for multiselect data binding (to set 2 selected items in the multiselect in the editor) -->
        </record>
        <record number="4">
            <nid>4</nid>
            <column1>row4col1</column1>
            <column2>BBBtxt,CCCtxt</column2>
            <mval>BBBval</mval><!-- Does not work for multiselect data binding (to set 2 selected items in the multiselect in the editor) -->
            <mval>CCCval</mval>
        </record>
    </resultset>
</root>

  • Multiselect data
<?xml version="1.0" encoding="utf-8"?>
<root>
    <resultset date="03/09/2013" size="5" time="10:13:50">
        <record number="1">
            <nid>1</nid>
            <valuenode>AAAval</valuenode>
            <textnode>AAAtxt</textnode>
        </record>
        <record number="2">
            <nid>2</nid>
            <valuenode>BBBval</valuenode>
            <textnode>BBBtxt</textnode>
        </record>
        <record number="3">
            <nid>3</nid>
            <valuenode>CCCval</valuenode>
            <textnode>CCCtxt</textnode>
        </record>
        <record number="4">
            <nid>4</nid>
            <valuenode>DDDval</valuenode>
            <textnode>DDDtxt</textnode>
        </record>
    </resultset>
</root>


Pascal
Top achievements
Rank 1
 answered on 11 Sep 2013
9 answers
2.5K+ views
I have a grid that is currently server bound and pageable showing data read from a database. I've noticed that if there is a lot of data and the underlying query is complicated rendering the page can take a long time. Getting the actual rows is not too bad as it just gets the first 20 (or a single page). The time consuming part is getting the count of rows. 

I would be happy not to know the total number of rows or even the number of pages. So I've tried turning off Info and Numeric paging options, but the count is still being calculated.

I've tried switching to a virtual scrolling grid as this seems to be Kendo's recommended approach for large datasets, but it seems this also performs a count so that it knows how big a scrollbar to show.

Is there any way to use the kendo grid without performing a count on the total number of items?
Alex
Top achievements
Rank 1
 answered on 11 Sep 2013
2 answers
282 views
Hello,
I'm using a kendo.data.Datasource with serverPaging and ServerSorting options in an MVVM implementation.
This datasource is roughly defined like this:
var MyDatasource = new kendo.data.DataSource({
  type: 'odata' /* for odata style IQueryable web api */
  serverPaging: true,
  serverSorting: true,
  pageSize: 15,
  transport: {
      read: {
          dataType: "json",
          url: "mywebapi/mydata"
})

The DataSource is used by a Kendo grid with scrollable: { virtual: true }.
A user has the ability to search for data where the searchparam is set on my viewmodel.
within my viewmodel i simply call "MyDatasource.read({ searchvalue: userparam })" to get the data from my web-api which works perfectly.

However, in combination with paging the parameter is lost when reading the next page.

Is there any way to preserve that param so it gets send with the next pages as well ?

Thanks in advance.

Marcel
Top achievements
Rank 1
 answered on 11 Sep 2013
4 answers
250 views
We currently are uploading a file and need to validate before saving it. If all validation passes we save the file and continue as normal. However if it fails we return a custom JSON object of error msgs to the client to correct. This works in IE 10 but not IE 8 (not sure about IE 9).

Little more info on what we are doing when validation fails – ASP MVC 4.
1. Set return HTTP Status code to 500 (Internal Svr Error)
2. To force IIS not to override our result set Response.TrySkipIisCustomErrors= true
3 . Return our JSON object (content-type of text/plain)

In IE 10 we get the object back in the xhr and it sees the status code of 500 and fires the error event. However in IE 8 we are getting the fakeXhr and it is determining success based on if it can parse the response as JSON. So of course it's successful and then calls the success event handler for the upload control. Now that it's fired the success event the upload control thinks all is well and updates UI/data to match. 

So is there a way to:
1. Return JSON and a status code of 500 and have IE 8 see it as an error regardless of if it can parse the JSON?
2. In the success mark it really as an error (fire error event) and not have the UI/data update as if it was successful? 

Any help would be greatly appreciated!
Patrick
Patrick
Top achievements
Rank 2
 answered on 11 Sep 2013
7 answers
527 views
Hello,

what is the best practises way to use custom forms for create and edit my events? I don't want use templates becouse I would like to use custom validation and dedesign of edit forms. If I call e.preventDefault() in edit function, scheduler returns error after second opening create form by double click in scheduler... 

cancelEvent() function isn't  too much elegant...

Any other possibilities?

Thanks David
Jsn
Top achievements
Rank 1
 answered on 11 Sep 2013
1 answer
185 views
Hi,

I have four multiSelects that contain hierarchical data so that  level 4 item knows its parents in level3, level2, and level1 and so on.

Each of multiselects has their own remote dataSource. Everytime when a dataSource requests for items from server the parameterMap function reads selections from its "parent" multiselects and puts them as parameters to request. I also attach the multiSelect's search text as parameter to the request.

Like this way:
$("#level3-multiselect").kendoMultiSelect({
        autoBind: false,
        dataTextField: "name",
        dataValueField: "id",
        dataSource: {
            serverFiltering: true,
            transport: {
                dataType: "jsonp",
                read: baseurl: 'http://myurl'
                parameterMap: function(options, operation) {                   
                    var _name = "";                   
                    if ('filter' in options && options.filter.filters.length > 0) {
                        _name = options.filter.filters[0].value;
                    }
                    return {
                        level1ids: getLevel1Ids().join(),
                        level2ids: getLevel2Ids().join(),                       
                        name: _name
                    }                      
                }
            },
            schema: {
                data: "items"
            }
        }
    });

My problem is that the multiselects parameterMap function is fired only when I change the text in that particular box. In additon to that, I would also like to run parameterMap function every time when a parent-level selection changes. I know there is a 'selected' event in multiSelect widget, but how can I call parameterMap function of a multiSelects dataSource?

Olli
Olli
Top achievements
Rank 1
 answered on 11 Sep 2013
1 answer
57 views
I'm having a problem with the Kendo UI mobile framework, my mobile website contains form input fields. Some have a declared type "date"or "time" and when clicking these it opens up the native selection method for this type of form. Unfortunately when "accepting"or clearing the input with this it crashes the mobile browser.

Testing was done with a Samsung Galaxy Note - Android version 4.0.3 , hope you can help with fixing this issue
Kamen Bundev
Telerik team
 answered on 11 Sep 2013
4 answers
362 views
Good morning, in our project our server expects time values to be a string in 24-hour format (HH:mm:ss).However we want to use timepickers that display 12-hour format with AM/PM (hh:mm tt) to the end user. Right now I am using:

$('.timePicker').kendoTimePicker(
{  
      format: "hh:mm tt"
      parseFormats: ["HH:mm:ss"]
});

and this works fine in terms of displaying the correct value from the database. However the problem is that the value of the field is saving back out to 12-hour format (hh:mm tt) instead of 24(HH:mm:ss).  

What can I do to display 12-hour format but save 24-hour?

Thank you, 

Guillermo Sanchez.


Alexander Popov
Telerik team
 answered on 11 Sep 2013
3 answers
214 views
Hello,

I looked at the view-demo (local view/remote view) and would like to know, if it is preferably to keep all the views in a mobile app in one single large file - if possible - or better to split them up in separate files? What is best practice? Any concerns when using Phonegap?

Thanks in advance
Per
Petyo
Telerik team
 answered on 11 Sep 2013
1 answer
249 views
My application features many modals, all with different widths. I understand you can set the width of a modal inline by doing something like:width: 400px margin-left: -200px;This works when the window is at 100%, but if you resize the window and it gets down to a small enough width the window is now -200px off of the screen. If I don't use margin-left: -200px then the window is not centered on the page at all.

In summary, I want to be able to set different widths to my modal windows, have them center on the screen when opened, and if the screen is resized the modal window needs to slide and stay in the center of the screen.

There has to be a more effieicent way to center these modal windows...

Any help is greatly appreciated.


Dimo
Telerik team
 answered on 11 Sep 2013
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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
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
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?