jQWidgets Forums
Forum Replies Created
-
Author
-
This functionality is Ok for less records but suppose we have 50,000 records then it will take time to search and make application hang for few time.SO please if there is any function SelectRowIndexByCellValue then it will be help full for relatime stock updates.
June 10, 2014 at 6:25 am in reply to: Custom Icon for Tree Node with JSON Data Custom Icon for Tree Node with JSON Data #55620Now i am not getting any error but unable to load image
Please see code below
$(document).ready(function () {
var data = [
{ “id”: “2”,
“parentid”: “1”,
“text”: “Bollinger Bands”,
“value”: “Bollinger Bands”,
“icon”: “../Images/Indicator.gif”
}, {
“id”: “3”,
“parentid”: “1”,
“text”: “Moving Average”,
“value”: “ma”,
“icon”: “../Images/Indicator.gif”
}, {
“id”: “4”,
“parentid”: “1”,
“text”: “Parabolic SAR”,
“value”: “Parabolic SAR”,
“icon”: “../Images/Indicator.gif”
}, {
“id”: “5”,
“parentid”: “1”,
“text”: “Ultimate Oscillator”,
“value”: “Ultimate Oscillator”,
“icon”: “../Images/Indicator.gif”
}, {
“text”: “Free Indicators”,
“id”: “1”,
“parentid”: “-1”,
“value”: “free”,
“icon”: “../Images/Indicator.gif”
}]// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘id’ },
{ name: ‘parentid’ },
{ name: ‘text’ },
{ name: ‘value’ }
],
icon: ‘icon’,
id: ‘id’,
localdata: data
};// create data adapter.
var dataAdapter = new $.jqx.dataAdapter(source);
// perform Data Binding.
dataAdapter.dataBind();
// get the tree items. The first parameter is the item’s id. The second parameter is the parent item’s id. The ‘items’ parameter represents
// the sub items collection name. Each jqxTree item has a ‘label’ property, but in the JSON data, we have a ‘text’ field. The last parameter
// specifies the mapping between the ‘text’ and ‘label’ fields.
var records = dataAdapter.getRecordsHierarchy(‘id’, ‘parentid’, ‘items’, [{ name: ‘text’, map: ‘label’}]);
$(‘#jqxTree’).jqxTree({ source: records, width: ‘300px’ });$(‘#jqxTree’).on(‘select’, function (event) {
var args = event.args;
var item = $(‘#jqxTree’).jqxTree(‘getItem’, args.element);
CustomStudy(item.value);
});});
function CustomStudy(study) {
if (!stxx || !stxx.chart.dataSet) return;
$$(“studyDialog”).querySelectorAll(“.title”)[0].innerHTML = study;
STXStudies.studyDialog(stxx, study, $$(“studyDialog”));
STXDialogManager.displayDialog(“studyDialog”);
}$(document).ready(function () {
function singleClick(event) {
var _item = event.target;
if (_item.tagName != “LI”) {
_item = $(_item).parents(“li:first”);
};
var item = $(‘#jqxTree’).jqxTree(‘getItem’, _item[0]);
if (item.isExpanded == true) {
$(‘#jqxTree’).jqxTree(‘collapseItem’, _item[0]);
} else {
$(‘#jqxTree’).jqxTree(‘expandItem’, _item[0]);
};
};
function doubleClick(event) {
var text = event.target.textContent;
var text2 = text.replace(/\s+/g, ‘ ‘);
alert(text2);
};
$(“#jqxTree .jqx-tree-item”).click(function (event) {
var that = this;
setTimeout(function () {
var dblclick = parseInt($(that).data(‘double’), 10);
if (dblclick > 0) {
$(that).data(‘double’, dblclick – 1);
} else {
singleClick.call(that, event);
}
}, 300);
}).dblclick(function (event) {
$(this).data(‘double’, 2);
doubleClick.call(this, event);
});
}); -
AuthorPosts