Telerik Forums
Kendo UI for jQuery Forum
0 answers
112 views
Hey,

while binding, is there any way to define something like a fallbackvalue, in case the property is undefined? Using Json and a documentbased database it is possible that some properties are not set, when binding happen.
And what about binding an input to a non-existing property of an object, will it be updated, when someone fill in the input?


Greetingz

Kevin
Kevin
Top achievements
Rank 1
 asked on 10 May 2012
3 answers
304 views
In odata __next is specified to let the datasource know how to request more results.  I'm using hand rolled json and my listview isn't showing the loadmore button.  What do I need to do to let it know it should request the same URL but increment the page number?

$("#searchResultsListView").kendoMobileListView({
    dataSource: ds,
    template: "#= f #",
    headerTemplate: "${value}",
    loadMore: true
});


var ds = new kendo.data.DataSource({
  transport: {
    read: {
      url: "http://localhost:3000/api/anagram",
      dataType: "jsonp",
      data: {
        format: 'html'
      }
    },
    parameterMap: function(options) {
      if (options.filter && options.filter.filters.length > 0)
        return {
          rack: options.filter.filters[0].value.replace(/\?/g,'-'),
          format: 'html',
          limit: options.pageSize,
          page: options.page
        };
      return options;
    }
  },
  group: 'length',
  pageSize: 10,
  page: 1,
  sort: {field: 'w', dir: 'asc'},
  filter: { field: 'rack', operator: 'eq', value: 'z' },
  serverFiltering: true,
  serverPaging: true,
  serverGrouping: true,
  serverSorting: true,
  error: function(e){
    alert(e);
    console.log(e);
  },
  change: function(e) {
    console.log('Data changed: ' this.total());
  },
  schema: {
    groups: 'groups',
    total: 'count',
    model: {
      fields: {
        length: {
          type: 'number'
        },
        w: {
          type: 'string'
        },
        f: {
          type: 'string'
        }
      }
    }
  }
});
Vijay
Top achievements
Rank 1
 answered on 10 May 2012
0 answers
294 views
I want to create a MVC 3 login form and use kendo to call the controller method to validate the user. What is the best approach to do this
Seminda
Top achievements
Rank 1
 asked on 10 May 2012
1 answer
88 views
Hello,

window web ui  is not working with JQuery 1.3 or 1.4 ver we are using in our application these old version if we update so most of the things will breaks.

so therefore we can not use jquery.min that was supplied with kendo ui kit.

could you please help me on this issue.

Thanks
Wajahat

Alex Gyoshev
Telerik team
 answered on 10 May 2012
19 answers
855 views
Hello,
I'm trying to create custom binding for CSS classes with switching by condition because the "style" binding isn't useful for my case. My cssClass binding uses "path with params " like "style" and "attr" bindings:

data-bind="cssClass: {condition: isEnabled, class1: style-red, class2: style-blue }"

In docs I see one example  this.bindings["slide"].get() for simple path like data-bind:"slide:isEnabled"
What is the legit solution for processing this types of bindings (with complicated pathes)?

Please, take a look on my realisation CSS custom binding example 
It works on page load but not works when isEnabled updated. I suspect that this behavior is due to the fact that I did not cal .get() function. But when I call that function I've got this error message: Uncaught TypeError: Object #<Object> has no method 'charAt'.
Rosen
Telerik team
 answered on 10 May 2012
0 answers
105 views
Can I implement both? I found that after I attached both on them to a control, drag is ok. However, when I try to resize the control, it also trigger drag event. Can I disable the drag event when I resize the control?
Derick
Top achievements
Rank 1
 asked on 10 May 2012
1 answer
155 views
I have a datasource which I display in a listview and am using a template.  I want to be able to shorten the text of one of the datasource fields on page load and am struggling with how to do this.  Can any one point me in the right direction?  Below is what I have so far.

    <div data-role="view" data-title="Control Panel - Mobile" id="listmessages" data-init="listMessagesInit">
        <h2>Customer Messages</h2>
        <p><?php echo $unread_messages . ' - unread messages'; ?></p> <a data-align="right" data-role="button" id="markasread">Mark as read</a><a data-align="right" data-role="button" id="delete">Delete</a>
        <ul id="message_list"></ul>
    </div>
      
     
   <script id="message_list_template" type="text/x-kendo-template">
        <li class="isnew_#= isnew #" id="#= id #"><a href="/messages/view/#= id #">
           <div style="float:left; width:150px; height: 50px">#= customer_name #<br />#= created #</div>
           <div style="height: 50px" id="message_#= id #" data-bind="value:short_text(message_#= id #, #= message #)">#= message #</div>
       </a></li>
   </script>   
 
    <script>
 
     function listMessagesInit(){
          
        function short_text(id, message){
            if (message.length > 100){
             var shortText = jQuery.trim(message).substring(0, 100).split(" ").slice(0, -1).join(" ") + "...";
            } else {
             var shortText = message;
            }
             
            $(id).text(shortText);
        }
 

     function listMessagesInit(){

          var messageDataSource = new kendo.data.DataSource({
           
            transport: {
                read: "/messages/data",
                dataType: "json",

                update:function(id, isnew) {
                    url:  "/messages/markasread/" + id + "/" + isnew ;  //how should these vars be passed? like this
                    type: "POST"
                },
                destroy: {
                    url: function(id, isnew) {
                            return "/messages/delete/" + id  ;  //or like this?
                        },
                   // url: "/messages/delete/210643",
                    type: "DELETE"
                },
                parameterMap: function(options, operation) {  //not sure what this does or if I even need it
                    if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                    }
                }                
            },              
            error: function(e) {
                alert(e.responseText);
            },              
            schema: {
              model: {
                  id: "id",
                  fields: {
                      created: { type: "string" },
                      message: { type: "string" },
                      customer_name: { type: "string" },        
                      isnew: { type: "string" }    
                     }
                    
                 }
             },
                  
           });

          $("#message_list").kendoMobileListView({
              dataSource: messageDataSource,
              //pullToRefresh: true,
              //appendOnRefresh: true,
              style: "inset",
              template: $("#message_list_template").text()
          });
          
      

     

}
Lee
Top achievements
Rank 1
 answered on 10 May 2012
0 answers
73 views
I have a kendo Window with a grid inside the content area. When I run this example on my pc everything works fine as expected. However, when I run the same example on my iPad, the grid does not scoll.

eg

if (!window.data("kendoWindow")) {
       window.kendoWindow({
            width: "800px",
            title: "Unscrollable grid",
            content: "grid_demo.html",
            close: onClose
        });            
}

(grid_demo.html is a copy of a grid example taken from the demos link). 
Kashim
Top achievements
Rank 1
 asked on 10 May 2012
3 answers
88 views
Hi

When i try and add a row for the grid using the popup editable grid, then the row gets added fine. Now i click on the edit button for the row in the grid and click on cancel the row disappears.
this is on version 2012.1.322..


Nikolay Rusev
Telerik team
 answered on 10 May 2012
1 answer
89 views
Here's the scenario...I have a button on my model....essentially a toggle.  However the model STATE should only change if the $.ajax call returns success...so this is what I tried

viewModel = kendo.observable({
        releaseMe: function (item) {
            release(item);
        }   
    });
 
function release(item) {
    var releaseState = item.data.Released;
    var campus = item.data.CampusID;
    var block = viewModel.BlockID;
    var url = "/api/cps/clerkship/blocks/" + block +  "/" + campus + "/";
 
    if (!releaseState)
        url += "release";
    else
        url += "unrelease";
 
 
    $.ajax({
        url: url,
        type: "PUT",
        data: {
            id: block,
            campus: campus
        },
        success: function (e) {
            if (!releaseState)
                item.set("Released", true); //WHAT SHOULD THIS BE
            else
                item.set("Released", false); //WHAT SHOULD THIS BE
        }
    });
}

Any idea?  Should it literally just be a simple
item.data.Released = true;
Atanas Korchev
Telerik team
 answered on 10 May 2012
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?