Telerik Forums
Kendo UI for jQuery Forum
0 answers
95 views
I have a datasource for messages and list a snippet of all the messages on one mobile view and view the full message in another mobile view.   I use the schema: parse function to make a snippet of the message on the list messages page.  This appears to be working well, however I do get an error message, "message is undefined" whenever I update the datasource.

I also have a similar error  "rawDate.split is not a function",  which is also initiated from the schema and again, only occurs when the datasource is updated.

Anyone any ideas why this is and what I can do to fix it?

var messageDataSource = new kendo.data.DataSource({
  
  transport: {
      read: "/messages/data",
      dataType: "json",
      update: {
          url:  function() {
              var url = "/messages/markasread/" + message_id + "/" + message_read;
              if (message_read == 0){
                if(unread_messages != 0){
                    var new_unread_messages = unread_messages-1;
                  } else {
                    var new_unread_messages = unread_messages;  
                  }
              } else if (message_read == 1){
                var new_unread_messages = unread_messages+1;
              }
              $("span#unread_messages").html(new_unread_messages); 
              $("span#unread_messages_hp").html(new_unread_messages);                            
               
              return url;
          },
          type: "POST",
          dataType: "json"
      },               
      destroy: {
          url:  function() {
              var delurl = "/messages/delete/" + message_id;
              return delurl;
          },                       
          type: "DELETE",
          dataType: "json"
      }
               
  },
 error: function(e) {
   alert(e.responseText);
 },
 sort: { field: "created", dir: "desc" },                                        
  schema: {
   
    model: {
        id: "id",
        fields: {
            message: { type: "string" },
            shortMessage:{ type: "string"},
            customer_name: { type: "string" }, 
            customer_telephone: { type: "string" },
            ip: { type: "string" },
            created: { type: "date", parse: parseDate },
            formatedCreated: { type: "string"},
            shortCreated: { type: "string" },
            email: { type: "string" },
            isnew: { type: "string" }  
           }
       },
      parse : function(data) {
              $.each(data, function(i, val){
                 //reduce text of message if being used for list
                 var message = val.message;    
                 if (message.length > 100){
                   var shortText = jQuery.trim(message).substring(0, 100).split(" ").slice(0, -1).join(" ") + "...";
                 } else {
                   var shortText = message;
                 }                     
 
                val.shortMessage = shortText;      
   
                //format the date
                var created = parseDate(val.created);
                 
                val.shortCreated = formatDate(created);
                 
                val.formatedCreated = val.created;
              });
          return data;
          }             
   }                      
 });

function parseDate(rawDate) {
    var bits = rawDate.split(/[-\s:]/);
    var year =  bits[2];
    var month = bits[1]-1;
    var day = bits[0];
    var hour = bits[3];
    var minute = bits[4];
    var validDate = new Date( year, month, day, hour, minute );
     
   return validDate;    
}
Lee
Top achievements
Rank 1
 asked on 29 May 2012
8 answers
222 views
Hi,
I use the example of this page http://piyushbhatt.blogspot.it/2011/12/kendoui-adding-menu-using-web-service.html,
but if want add a sub-menu i use parentItem = parentItem.find("li:contains('" + listParent[i] + "')");
The sub menu is add but then image right-arrow not show
Why ?
 
Thanks
Vitantonio
Top achievements
Rank 1
 answered on 29 May 2012
0 answers
86 views
Hi

I have creatred an oData feed that has two tables, Product and ProductAttributes. Given that ProductAttributes is a child table of Products how would I filter the oData via this table. Can this be achieved as follows: (proposed filter in [bold])

    var products = new kendo.data.DataSource({
        type: "odata",
        transport: {
            read: {
                url: "http://odata.com/DataService.svc/Products",
                data: {
                    expand: "ProductAttributes",
                    filter: [{ field: "AttributeType", operator: "contains", value: "Range"},
                               {...},
                               {...}]

                }
            },
        },
        pageSize: 30,
        serverFiltering: true,
        serverPaging: true,
        serverGrouping: true,
        serverSorting: true,
        aggregate: [{ field: "Price", aggregate: "max" }, { field: "Price", aggregate: "min"}]
});
Alan
Top achievements
Rank 1
 asked on 29 May 2012
2 answers
142 views
I have my treeview output as below:-

<div class=​"k-mid">​
<span class=​"k-icon k-plus">​</span>​
<span class=​"k-in k-state-hover">​
<span categoryId="11">​TestNameHere</span>​
</span>​
</div>​

When I select a node from the treeview I can alert(treeview.text(e.node)) to get the text - but I need access to the categoryId value, anyone know how I can get this?

Thanks
Gregor
Top achievements
Rank 1
 answered on 29 May 2012
1 answer
154 views
hello
I have a datepicker which I disabled certain days.
as this can be done?

regards
Ricardo
Top achievements
Rank 1
 answered on 29 May 2012
4 answers
240 views
I have the following function for a custom editor:

function myEditor(container, options) {
$('<input data-text-field="name" data-value-field="id" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: true,
dataSource: {
type: "json",
transport: {
read: "http://myurl"
}
}
});
}

My data source has two properties, "id" and "name", The "name" is shown in the dropdown and the "id" is submitted to my database.
Everything works fine and my data is sent as I intend it to be. The problem is that my grid then shows the "id" property of my data after the item is added, instead of the "name" property. If I refresh, the data is read from my database via the main grid datasource definition and everything shows correctly.

How can I make my grid show the "Name" property without synching the data source?

Any help appreciated, thanks.
Steve
Top achievements
Rank 1
 answered on 29 May 2012
2 answers
1.4K+ views
Is there a way to set a default grouping column so that the grid is grouped on loading?

Steve
Top achievements
Rank 1
 answered on 29 May 2012
0 answers
100 views
Hi,

Is it available the option like visible: false for a kendo ui grid column?

column: [
title: "class",
field: "CLASS",
width: "120px",
]

Thanks In Advance
Ganesh
Top achievements
Rank 2
 asked on 29 May 2012
1 answer
93 views
When my tab contains some elements that are floated they appear, however, the tab background is the wrong color because the tab height is 0.
http://jsfiddle.net/RichardAD/h6SLH

Any suggestions on making even floated stuff look like it is in the tab?
Iliana Dyankova
Telerik team
 answered on 29 May 2012
0 answers
98 views
How to make zero index column of Grid fixed while other column movable(reorderable=true) ?
Engifaar
Top achievements
Rank 1
 asked on 29 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
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
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
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
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?