Link java script with the wix drop down box - velo
I am new to Wix and in js Currently, I want to add the drop-down feature from there the user can select their country. One way to implement that by adding all country manually. But I found a js file which contains all the countries from this site https://www.wix.com/code/home/forum/community-discussion/how-do-i-add-a-drop-down-menu-with-a-list-of-countries-city I wanna know how can I add the js code with the drop-down box.
Pretty simple. Use something like this:
export const countries = [
{ value: "Afghanistan", label: "Afghanistan" },
{ value: "Albania", label: "Albania" },
{ value: "Algeria", label: "Algeria" },
{ value: "Andorra", label: "Andorra" },
{ value: "Angola", label: "Angola" },
{ value: "Antigua and Barbuda", label: "Antigua and Barbuda" },
{ value: "Argentina", label: "Argentina" },
{ value: "Armenia", label: "Armenia" },
{ value: "Australia", label: "Australia" },
{ value: "Austria", label: "Austria" },
{ value: "Azerbaijan", label: "Azerbaijan" },
{ value: "Bahamas", label: "Bahamas" },
{ value: "Bahrain", label: "Bahrain" },
{ value: "Bangladesh", label: "Bangladesh" },
{ value: "Barbados", label: "Barbados" },
{ value: "Belarus", label: "Belarus" },
{ value: "Belgium", label: "Belgium" },
{ value: "Belize", label: "Belize" },
{ value: "Benin", label: "Benin" },
{ value: "Bhutan", label: "Bhutan" },
{ value: "Bolivia", label: "Bolivia" },
{ value: "Bosnia & Herzegovina", label: "Bosnia & Herzegovina" },
{ value: "Botswana", label: "Botswana" },
{ value: "Brazil", label: "Brazil" },
{ value: "Brunei", label: "Brunei" },
{ value: "Bulgaria", label: "Bulgaria" },
{ value: "Burkina Faso", label: "Burkina Faso" },
{ value: "Burundi", label: "Burundi" },
{ value: "Cabo Verde", label: "Cabo Verde" },
{ value: "Cambodia", label: "Cambodia" },
{ value: "Cameroon", label: "Cameroon" },
{ value: "Canada", label: "Canada" },
{ value: "Central African Republic", label: "Central African Republic" },
{ value: "Chad", label: "Chad" },
{ value: "Chile", label: "Chile" },
{ value: "China", label: "China" },
{ value: "Colombia", label: "Colombia" },
{ value: "Comoros", label: "Comoros" },
{ value: "Congo", label: "Congo" },
{ value: "Costa Rica", label: "Costa Rica" },
{ value: "Croatia", label: "Croatia" },
{ value: "Cuba", label: "Cuba" },
{ value: "Cyprus", label: "Cyprus" },
{ value: "Czech Republic", label: "Czech Republic" },
{ value: "Côte d'Ivoire", label: "Côte d'Ivoire" },
{ value: "Denmark", label: "Denmark" },
{ value: "Djibouti", label: "Djibouti" },
{ value: "Dominica", label: "Dominica" },
{ value: "Dominican Republic", label: "Dominican Republic" },
{ value: "DR Congo", label: "DR Congo" },
{ value: "Ecuador", label: "Ecuador" },
{ value: "Egypt", label: "Egypt" },
{ value: "El Salvador", label: "El Salvador" },
{ value: "Equatorial Guinea", label: "Equatorial Guinea" },
{ value: "Eritrea", label: "Eritrea" },
{ value: "Estonia", label: "Estonia" },
{ value: "Ethiopia", label: "Ethiopia" },
{ value: "Fiji", label: "Fiji" },
{ value: "Finland", label: "Finland" },
{ value: "France", label: "France" },
{ value: "Gabon", label: "Gabon" },
{ value: "Gambia", label: "Gambia" },
{ value: "Georgia", label: "Georgia" },
{ value: "Germany", label: "Germany" },
{ value: "Ghana", label: "Ghana" },
{ value: "Greece", label: "Greece" },
{ value: "Grenada", label: "Grenada" },
{ value: "Guatemala", label: "Guatemala" },
{ value: "Guinea", label: "Guinea" },
{ value: "Guinea-Bissau", label: "Guinea-Bissau" },
{ value: "Guyana", label: "Guyana" },
{ value: "Haiti", label: "Haiti" },
{ value: "Holy See", label: "Holy See" },
{ value: "Honduras", label: "Honduras" },
{ value: "Hungary", label: "Hungary" },
{ value: "Iceland", label: "Iceland" },
{ value: "India", label: "India" },
{ value: "Indonesia", label: "Indonesia" },
{ value: "Iran", label: "Iran" },
{ value: "Iraq", label: "Iraq" },
{ value: "Ireland", label: "Ireland" },
{ value: "Israel", label: "Israel" },
{ value: "Italy", label: "Italy" },
{ value: "Jamaica", label: "Jamaica" },
{ value: "Japan", label: "Japan" },
{ value: "Jordan", label: "Jordan" },
{ value: "Kazakhstan", label: "Kazakhstan" },
{ value: "Kenya", label: "Kenya" },
{ value: "Kiribati", label: "Kiribati" },
{ value: "Kuwait", label: "Kuwait" },
{ value: "Kyrgyzstan", label: "Kyrgyzstan" },
{ value: "Laos", label: "Laos" },
{ value: "Latvia", label: "Latvia" },
{ value: "Lebanon", label: "Lebanon" },
{ value: "Lesotho", label: "Lesotho" },
{ value: "Liberia", label: "Liberia" },
{ value: "Libya", label: "Libya" },
{ value: "Liechtenstein", label: "Liechtenstein" },
{ value: "Lithuania", label: "Lithuania" },
{ value: "Luxembourg", label: "Luxembourg" },
{ value: "Madagascar", label: "Madagascar" },
{ value: "Malawi", label: "Malawi" },
{ value: "Malaysia", label: "Malaysia" },
{ value: "Maldives", label: "Maldives" },
{ value: "Mali", label: "Mali" },
{ value: "Malta", label: "Malta" },
{ value: "Marshall Islands", label: "Marshall Islands" },
{ value: "Mauritania", label: "Mauritania" },
{ value: "Mauritius", label: "Mauritius" },
{ value: "Mexico", label: "Mexico" },
{ value: "Micronesia", label: "Micronesia" },
{ value: "Moldova", label: "Moldova" },
{ value: "Monaco", label: "Monaco" },
{ value: "Mongolia", label: "Mongolia" },
{ value: "Montenegro", label: "Montenegro" },
{ value: "Morocco", label: "Morocco" },
{ value: "Mozambique", label: "Mozambique" },
{ value: "Myanmar", label: "Myanmar" },
{ value: "Namibia", label: "Namibia" },
{ value: "Nauru", label: "Nauru" },
{ value: "Nepal", label: "Nepal" },
{ value: "Netherlands", label: "Netherlands" },
{ value: "New Zealand", label: "New Zealand" },
{ value: "Nicaragua", label: "Nicaragua" },
{ value: "Niger", label: "Niger" },
{ value: "Nigeria", label: "Nigeria" },
{ value: "North Korea", label: "North Korea" },
{ value: "Norway", label: "Norway" },
{ value: "Oman", label: "Oman" },
{ value: "Pakistan", label: "Pakistan" },
{ value: "Palau", label: "Palau" },
{ value: "Panama", label: "Panama" },
{ value: "Papua New Guinea", label: "Papua New Guinea" },
{ value: "Paraguay", label: "Paraguay" },
{ value: "Peru", label: "Peru" },
{ value: "Philippines", label: "Philippines" },
{ value: "Poland", label: "Poland" },
{ value: "Portugal", label: "Portugal" },
{ value: "Qatar", label: "Qatar" },
{ value: "Romania", label: "Romania" },
{ value: "Russia", label: "Russia" },
{ value: "Rwanda", label: "Rwanda" },
{ value: "Saint Kitts & Nevis", label: "Saint Kitts & Nevis" },
{ value: "Saint Lucia", label: "Saint Lucia" },
{ value: "Samoa", label: "Samoa" },
{ value: "San Marino", label: "San Marino" },
{ value: "Sao Tome & Principe", label: "Sao Tome & Principe" },
{ value: "Saudi Arabia", label: "Saudi Arabia" },
{ value: "Senegal", label: "Senegal" },
{ value: "Serbia", label: "Serbia" },
{ value: "Seychelles", label: "Seychelles" },
{ value: "Sierra Leone", label: "Sierra Leone" },
{ value: "Singapore", label: "Singapore" },
{ value: "Slovakia", label: "Slovakia" },
{ value: "Slovenia", label: "Slovenia" },
{ value: "Solomon Islands", label: "Solomon Islands" },
{ value: "Somalia", label: "Somalia" },
{ value: "South Africa", label: "South Africa" },
{ value: "South Korea", label: "South Korea" },
{ value: "South Sudan", label: "South Sudan" },
{ value: "Spain", label: "Spain" },
{ value: "Sri Lanka", label: "Sri Lanka" },
{ value: "St. Vincent & Grenadines", label: "St. Vincent & Grenadines" },
{ value: "State of Palestine", label: "State of Palestine" },
{ value: "Sudan", label: "Sudan" },
{ value: "Suriname", label: "Suriname" },
{ value: "Swaziland", label: "Swaziland" },
{ value: "Sweden", label: "Sweden" },
{ value: "Switzerland", label: "Switzerland" },
{ value: "Syria", label: "Syria" },
{ value: "Tajikistan", label: "Tajikistan" },
{ value: "Tanzania", label: "Tanzania" },
{ value: "TFYR Macedonia", label: "TFYR Macedonia" },
{ value: "Thailand", label: "Thailand" },
{ value: "Timor-Leste", label: "Timor-Leste" },
{ value: "Togo", label: "Togo" },
{ value: "Tonga", label: "Tonga" },
{ value: "Trinidad and Tobago", label: "Trinidad and Tobago" },
{ value: "Tunisia", label: "Tunisia" },
{ value: "Turkey", label: "Turkey" },
{ value: "Turkmenistan", label: "Turkmenistan" },
{ value: "Tuvalu", label: "Tuvalu" },
{ value: "U.K.", label: "U.K." },
{ value: "U.S.", label: "U.S." },
{ value: "Uganda", label: "Uganda" },
{ value: "Ukraine", label: "Ukraine" },
{ value: "United Arab Emirates", label: "United Arab Emirates" },
{ value: "Uruguay", label: "Uruguay" },
{ value: "Uzbekistan", label: "Uzbekistan" },
{ value: "Vanuatu", label: "Vanuatu" },
{ value: "Venezuela", label: "Venezuela" },
{ value: "Viet Nam", label: "Viet Nam" },
{ value: "Yemen", label: "Yemen" },
{ value: "Zambia", label: "Zambia" },
{ value: "Zimbabwe", label: "Zimbabwe" }
];
$w.onReady( () => {
$w("#dropdown1").options = countries;
} );
Related
ElasticSearch difference aggregation
This is a piece of my data stored : [ { "name": "disk.device.write.requests", "type": "cumulative", "unit": "request", "volume": 0, "user_id": "b0407ee332f6474c87d1e666262d4783", "project_id": "75ebb9556f8c4e36b0d3e722a57ff3bb", "resource_id": "7837ab92-5eb7-4cdc-9da3-5f1d2a385841-hda", "timestamp": "2021-11-14T13:28:45.873289", "resource_metadata": { "display_name": "ali", "name": "instance-00000004", "instance_id": "7837ab92-5eb7-4cdc-9da3-5f1d2a385841", "instance_type": "Tochal", "host": "b34b47c6129603ae3d0387bfa8bf8fe487b0a8424d7e3debb6c69b6d", "instance_host": "os", "flavor": { "id": "t1", "name": "Tochal", "vcpus": 4, "ram": 4096, "disk": 40, "ephemeral": 0, "swap": 0 }, "status": "active", "state": "running", "task_state": "", "image": { "id": "f77ec16e-1c4e-4ed7-b340-b537ab008367" }, "image_ref": "f77ec16e-1c4e-4ed7-b340-b537ab008367", "image_ref_url": null, "architecture": "x86_64", "os_type": "hvm", "vcpus": 4, "memory_mb": 4096, "disk_gb": 40, "ephemeral_gb": 0, "root_gb": 40, "disk_name": "hda" }, "source": "openstack", "id": "cafd91ab-454e-11ec-b8ba-3b125e027b37", "monotonic_time": null } ...] I've written an aggregation to group data in one hour by name field for a project: { index: 'cm', size: 0, pretty: true, body: { query: { bool: { must: [ { match: { project_id: '75ebb9556f8c4e36b0d3e722a57ff3bb', }, }, { range: { timestamp: { gte: 'now-1H', }, }, }, ], }, }, aggs: { names: { terms: { field: 'name' }, aggs: { myvalue: { sum: { field: 'volume' } }, }, }, }, }, } And it's output is: "aggregations": { "names": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 4, "buckets": [ { "key": "disk.device.read.bytes", "doc_count": 8, "hatprice": { "value": 2311073040 } }, { "key": "disk.device.read.requests", "doc_count": 8, "hatprice": { "value": 68796 } }, { "key": "disk.device.write.bytes", "doc_count": 8, "hatprice": { "value": 13117853696 } }, { "key": "disk.device.write.requests", "doc_count": 8, "hatprice": { "value": 776618 } }, { "key": "cpu", "doc_count": 4, "hatprice": { "value": 4541150000000 } }, { "key": "memory.usage", "doc_count": 4, "hatprice": { "value": 1741 } }, { "key": "network.incoming.bytes", "doc_count": 4, "hatprice": { "value": 532735722 } }, { "key": "network.incoming.packets", "doc_count": 4, "hatprice": { "value": 864945 } }, { "key": "network.outgoing.bytes", "doc_count": 4, "hatprice": { "value": 58562803 } }, { "key": "network.outgoing.packets", "doc_count": 4, "hatprice": { "value": 439204 } } ] } } I need to aggregate base on volume field minus previous hour volume value. Is it possible? e.g: network.incoming.bytes in current hour. (not from first).
I think I've solved the problem using SERIAL_DIFF but not sure: { index: 'cm', size: 0, pretty: true, body: { query: { bool: { must: [ { match: { project_id: '75ebb9556f8c4e36b0d3e722a57ff3bb', }, }, { range: { timestamp: { gte: 'now-2H', }, }, }, ], }, }, aggs: { names: { terms: { field: 'name' }, aggs: { mydateh: { date_histogram: { field: 'timestamp', calendar_interval: 'hour', }, aggs: { volrate: { max: { field: 'volume' } }, diff: { serial_diff: { buckets_path: 'volrate', lag: 1, }, }, }, }, }, }, }, }, }
DSL query to find the elements from array of dictionaries
I have a index in elastic search called professor If for cross field i need "AND" condition for same field array i need to OR condition I need to search BusinessArea which is Research or Accounting this is array of fields(OR) statement AND I need to search Role is Developer or Tester condition this is array of fields(OR) statement AND I need to search Location is NY(&) condition test = [{ 'id': '1', 'name': 'Group1', 'BusinessArea': [ { 'id': '14', 'name': 'Accounting' }, { 'id': '3', 'name': 'Accounting' } ],'Designation': [ { 'id': '16', 'name': 'L1' }, { 'id': '20', 'name': 'L2' }, { 'id': '25', 'name': 'L2' }, ] }, { 'id': '2', 'name': 'Group1', 'BusinessArea': [ { 'id': '14', 'name': 'Research' }, { 'id': '3', 'name': 'Accounting' } ], 'Role': [ { 'id': '5032', 'name': 'Tester' }, { 'id': '5033', 'name': 'Developer' } ], 'Designation': [ { 'id': '16', 'name': 'L1' }, { 'id': '20', 'name': 'L2' }, { 'id': '25', 'name': 'L2' }, ] }, { 'id': '1', 'name': 'Group1', 'BusinessArea': [ { 'id': '14', 'name': 'Research' }, { 'id': '3', 'name': 'Engineering' } ], 'Role': [ { 'id': '5032', 'name': 'Developer' }, { 'id': '5033', 'name': 'Developer' } ], 'Designation': [ { 'id': '16', 'name': 'L1' }, { 'id': '20', 'name': 'L2' }, { 'id': '25', 'name': 'L2' }] }] Query is below,3rd one got it, How to add 1 and 2 content_search = es.search(index="professor", body={ "query": { "bool": { "must": { "match_all": {} }, "filter": [ { "term": { "Location.keyword": "NY" } } ] } } }) content_search ['hits']['hits']
I need to search Location is NY(&) condition I have not added this condition, since there is no field named Location in your sample data Try out this below query: Search Query: { "query": { "bool": { "must": [ { "terms": { "BusinessArea.name.keyword": [ "Research", "Accounting" ] } }, { "terms": { "Role.name.keyword": [ "Developer", "Tester" ] } } ] } } } Search Result: "hits": [ { "_index": "stof_64386038", "_type": "_doc", "_id": "2", "_score": 2.0, "_source": { "id": "2", "name": "Group1", "BusinessArea": [ { "id": "14", "name": "Research" }, { "id": "3", "name": "Accounting" } ], "Role": [ { "id": "5032", "name": "Tester" }, { "id": "5033", "name": "Developer" } ], "Designation": [ { "id": "16", "name": "L1" }, { "id": "20", "name": "L2" }, { "id": "25", "name": "L2" } ] } }, { "_index": "stof_64386038", "_type": "_doc", "_id": "3", "_score": 2.0, "_source": { "id": "1", "name": "Group1", "BusinessArea": [ { "id": "14", "name": "Research" }, { "id": "3", "name": "Engineering" } ], "Role": [ { "id": "5032", "name": "Developer" }, { "id": "5033", "name": "Developer" } ], "Designation": [ { "id": "16", "name": "L1" }, { "id": "20", "name": "L2" }, { "id": "25", "name": "L2" } ] } } ]
You can use bool query like this: content_search = es.search(index="professor", body={ "query": { "bool": { "must": [ { "terms": { "BusinessArea.name.keyword": ["Research","Accounting"] } }, { "terms": { "Role.name.keyword": ["Developer","Tested"] } } ] }, "filter": [ { "term": { "Location.keyword": "NY" } } ] } })
Ghost image showing up in kendo grid drag and drop
A kendo grid has been having a problem with the drag-and-drop functionality, where it has a copy of all the data essentially stuck to the left side of the grid, in-line with the cursor. The grid that I attach it to is set to editable, however, that appears to have no impact on this. Disabling editing does not fix the problem. It is also worth noting that the grid is bound to the dynamic type, which may have some impact, but I didn't find anything looking into that. Sortable block is below #(Html.Kendo().Sortable() .For("#QuestionGridEditable") .Filter("table > tbody > tr") .Cursor("move") .Axis(SortableAxis.Y) .PlaceholderHandler("placeholder") .ContainerSelector("#QuestionGridEditable tbody") .Events(e => { e.Change("onDrag"); e.Move("startDrag"); }) Image of the problem Generated javascript <script> kendo.syncReady(function() { jQuery("#QuestionGridEditable").kendoGrid({ "dataBound": onNewRow, "columns": [{ "title": "#", "attributes": { "style": "width: 2em" }, "headerAttributes": { "data-field": "number", "data-title": "#" }, "field": "number", "encoded": true, "editor": "\u003cinput id=\"number\" max=\"2147483647\" min=\"-2147483648\" name=\"number\" style=\"width:100%\" type=\"text\" /\u003e\u003cscript\u003e\r\n\tkendo.syncReady(function(){jQuery(\"#number\").kendoNumericTextBox({\"format\":\"n0\",\"decimals\":0});});\r\n\u003c/script\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"number\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e", "editable": funcFalse }, { "title": "Visibility", "attributes": { "style": "width: 30%" }, "headerAttributes": { "data-field": "viewableby", "data-title": "Visibility" }, "template": "#=ArrayToString(viewableby)#", "field": "viewableby", "encoded": true, "editor": "\u003cselect id=\"viewableby\" multiple=\"multiple\" name=\"viewableby\"\u003e\u003c/select\u003e\u003cscript\u003e\r\n\tkendo.syncReady(function(){jQuery(\"#viewableby\").kendoMultiSelect({\"dataSource\":[\"Everyone\",\"Faculty\",\"Students\",\"Self\"],\"value\":\"#=ViewersCompactToList(data)#\"});});\r\n\u003c/script\u003e\r\n\r\n\r\n\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"viewableby\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e" }, { "title": "Radio button", "headerAttributes": { "data-field": "cells[0].Text.text", "data-title": "Radio button" }, "field": "cells[0].Text.text", "encoded": true, "editor": "\u003cbutton id=\"buttonAddRadio\" class=\"k-button k-button-icontext\" onclick=\"addRB\"\u003e+\u003c/button\u003e\r\n\u003cinput class=\"k-textbox\" id=\"cells_0__Text_text\" name=\"cells[0].Text.text\" /\u003e\r\n \r\n\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"cells[0].Text.text\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e", "editable": funcTrue }, { "title": "Basic text entry static", "headerAttributes": { "data-field": "cells[1].Text.text", "data-title": "Basic text entry static" }, "field": "cells[1].Text.text", "encoded": true, "editor": "\u003cinput class=\"k-textbox\" id=\"cells_1__Text_text\" name=\"cells[1].Text.text\" /\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"cells[1].Text.text\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e", "editable": funcTrue }, { "attributes": { "style": "width: 2em" }, "command": [{ "name": "destroy", "buttonType": "ImageAndText", "text": "Delete" }] }], "scrollable": false, "editable": { "confirmation": "Are you sure you want to delete this record?", "confirmDelete": "Delete", "cancelDelete": "Cancel", "mode": "incell", "template": null, "createAt": "bottom", "create": true, "update": true, "destroy": true }, "toolbar": { "command": [{ "name": null, "buttonType": "ImageAndText", "text": "Add new record" }, { "name": null, "buttonType": "ImageAndText" }] }, "messages": { "noRecords": "No records available." }, "dataSource": { "type": (function() { if (kendo.data.transports['aspnetmvc-ajax']) { return 'aspnetmvc-ajax'; } else { throw new Error('The kendo.aspnetmvc.min.js script is not included.'); } } )(), "transport": { "read": { "url": "/FeedbackForm/ReadQuestionGrid/57" }, "prefix": "", "update": { "url": "/FeedbackForm/UpdateQuestionGrid" }, "create": { "url": "/FeedbackForm/CreateQuestionGrid/57" }, "destroy": { "url": "/FeedbackForm/DestroyQuestionGrid" } }, "serverPaging": true, "serverSorting": true, "serverFiltering": true, "serverGrouping": true, "serverAggregates": true, "filter": [], "schema": { "data": "Data", "total": "Total", "errors": "Errors", "model": { "id": "id", "fields": { "id": { "editable": false, "type": "number", "defaultValue": -1 }, "number": { "type": "number" }, "viewableby": { "type": "object", "defaultValue": [] }, "cells": { "type": "object", "defaultValue": [{ "Location": { "id": 0, "question_id": 0, "column_id": 14 }, "Text": { "id": 0, "location_id": 0, "viewableby": null, "text": null } }, { "Location": { "id": 0, "question_id": 0, "column_id": 9 }, "Text": { "id": 0, "location_id": 0, "viewableby": null, "text": null } }] } } } }, "batch": true }, "navigatable": true }); }); <script> kendo.syncReady(function() { jQuery("#QuestionGridEditable").kendoSortable({ "change": onDrag, "filter": "table \u003e tbody \u003e tr", "container": "#QuestionGridEditable tbody", "axis": "y", "cursor": "move", "placeholder": placeholder }); });
The problem came down to the HintHandler. Setting the sortable item's HintHandler to a JavaScript function that returned false fixed the issue with the ghost image.
How to get the month names in kendo chart by using function
How to create a function to get the month as Jan,feb.. displayed in kendo chart x axis. var internetUsers = [ { "Month": "1", "year": "2010", "value": 1 }, { "Month": "2", "year": "2010", "value": 2 }, { "Month": "3", "year": "2010", "value": 3 }, { "Month": "4", "year": "2010", "value": 4 }, { "Month": "5", "year": "2010", "value": 5 }, { "Month": "6", "year": "2010", "value": 6 }, { "Month": "7", "year": "2010", "value": 7 }, { "Month": "8", "year": "2010", "value": 8 }]; function createChart() { $("#chart").kendoChart({ theme: $(document).data("kendoSkin") || "default", dataSource: { data: internetUsers, group: { field: "year" }, sort: { field: "year", dir: "asc" } }, title: { text: "Sales" }, legend: { position: "bottom" }, seriesDefaults: { type: "column" }, series: [{ field: "value" }], valueAxis: { labels: { format: "{0}$" }, line: { visible: false }, axisCrossingValue: 0 }, categoryAxis: { field: "Month" }, tooltip: { visible: true, format: "{0}%", template: "#= series.name #: #= value #" } }); } $(document).ready(function() { setTimeout(function() { // Initialize the chart with a delay to make sure // the initial animation is visible createChart(); $("#example").bind("kendo:skinChange", function(e) { createChart(); }); }, 400); }); </script>
You could use kendoui's time format function: kendo.toString(new Date(2000, value, 1), "MMMM"); // if value = 9, it would output September Check out kendoui's date format page. It is VERY helpful. http://docs.telerik.com/kendo-ui/getting-started/framework/globalization/dateformatting
First add an array to hold the month names, like so: var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug"]; then modify the categoryAxis to use this array categoryAxis: { field: "Month", labels: { template: "#=monthNames[value - 1]#" }, },
jqgrid - search toolbar
The Toolbar Search demo under section 3.7 draws up the search toolbar for every column. Is it possible to have just one search toolbar that filters data across all columns and all pages? For more info: jqGrid filtering on the client-side using "filterToolbar" JSON { "mypage":{ "outerwrapper":{ "page":"1", "total":"2", "records":"2", "innerwrapper":{ "rows":[ { "id":"1", "cells": [ { "fieldType": "image", "label": "image", "value": "<img src=icon.gif>" }, { "fieldType": "number", "label": "number", "value": 100 }, { "fieldType": "string", "label": "string", "value": "James Kisnar" }, { "fieldType": "alphanumeric", "label": "alphanumeric", "value": "77 Wall Street" }, { "fieldType": "date", "label": "date", "value": "12/20/2011" }, { "fieldType": "decimal", "label": "decimal", "value": "23.55" } ] }, { "id":"2", "cells": [ { "fieldType": "image", "label": "image", "value": "<img src=icon.gif>" }, { "fieldType": "number", "label": "number", "value": 140 }, { "fieldType": "string", "label": "string", "value": "James Kitchener" }, { "fieldType": "alphanumeric", "label": "alphanumeric", "value": "123 ABC" }, { "fieldType": "date", "label": "date", "value": "12/20/2011" }, { "fieldType": "decimal", "label": "decimal", "value": "23.55" } ] }, { "id":"3", "cells": [ { "fieldType": "image", "label": "image", "value": "<img src=icon.gif>" }, { "fieldType": "number", "label": "number", "value": 657 }, { "fieldType": "string", "label": "string", "value": "Loo Gatner" }, { "fieldType": "alphanumeric", "label": "alphanumeric", "value": "123 XYZ" }, { "fieldType": "date", "label": "date", "value": "12/20/2011" }, { "fieldType": "decimal", "label": "decimal", "value": "23.55" } ] }, { "id":"4", "cells": [ { "fieldType": "image", "label": "image", "value": "<img src=icon.gif>" }, { "fieldType": "number", "label": "number", "value": 1290 }, { "fieldType": "string", "label": "string", "value": "William Parker" }, { "fieldType": "alphanumeric", "label": "alphanumeric", "value": "123 FGH" }, { "fieldType": "date", "label": "date", "value": "12/20/2011" }, { "fieldType": "decimal", "label": "decimal", "value": "23.55" } ] } ] } } } } JQGrid Definition $(function (){ var getValueByName = function (cells, cellItem) { var i, count = cells.length, item; for (i = 0; i < count; i += 1) { item = cells[i]; if (item.label === cellItem) { return item.value; } } return ''; }; $("#myjqgrid").jqGrid({ url: "jqgrid.json", datatype: "json", contentType: "application/x-javascript; charset=utf-8", colNames:['Image','Number', 'String', 'Alphanumeric','Date','Decimal'], colModel:[ {name:'image',index:'image',jsonmap:function(obj){return getValueByName(obj.cells, "image");}, width:150, align:"center"}, {name:'number',index:'number',jsonmap:function(obj){return getValueByName(obj.cells, "number");}, width:150, align:"left", sortable:true}, {name:'string',index:'string',jsonmap:function(obj){return getValueByName(obj.cells, "string");}, width:150, align:"left", sortable:true}, {name:'alphanumeric',index:'alphanumeric',jsonmap:function(obj){return getValueByName(obj.cells, "alphanumeric");}, width:200, align:"left", sortable:true}, {name:'date',index:'date',jsonmap:function(obj){return getValueByName(obj.cells, "date");}, width:150,align:"left", sortable:true}, {name:'decimal',index:'decimal',jsonmap:function(obj){return getValueByName(obj.cells, "decimal");}, width:150,align:"left", sortable:true}, ], jsonReader: { root: "mypage.outerwrapper.innerwrapper.rows", page: "mypage.outerwrapper.page", total: "mypage.outerwrapper.total", records: "mypage.outerwrapper.records", repeatitems: false }, rowNum:2, rowList:[2, 4], pager: '#Pager', recordpos: 'left', multiboxonly:true, viewrecords: true, sortorder: "desc", multiselect: true, scrolloffset: 0, loadonce: true, sortable: true, sorttype: "text", cache: true, height: "120px" }); $("#myjqgrid").jqGrid('navGrid','#Pager',{add:false,del:false,edit:false,position:'right'}); $("#myjqgrid").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false}); });