EasyUI Forum
April 29, 2024, 03:55:06 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / EasyUI for jQuery / Re: How to determine which tool in which panel has been clicked? on: February 16, 2018, 06:29:51 AM
Ok - here is a solution that worked for me... I added a property "action" into my list of panels....


Code:
var p = $('<div/>').attr('id',options.id).appendTo('body');
p.panel(options);
if(options.action)
{
var tool = $('#' + options.id).panel('header').find('.panel-tool');
tool.prepend('<a href="javascript:' + options.action + '" class="icon-refresh"></a>');  // add an icon
}
$('#ucPortal').portal('add',{ panel:p, columnIndex:columnIndex });
2  General Category / EasyUI for jQuery / How to determine which tool in which panel has been clicked? on: February 16, 2018, 02:38:20 AM
I'm using Portal Layout to show widgets and want a single refresh tool on each panel (which I've done), but how can I tell which panel 'button' has been pressed.

I've modified the example for Portal layout below, but can't see anything in the event that indicates something I can reference.

Code:
function addPanels(portalState){
var columns = portalState.split(':');
for(var columnIndex=0; columnIndex<columns.length; columnIndex++){
var cc = columns[columnIndex].split(',');
for(var j=0; j<cc.length; j++){
var options = getPanelOptions(cc[j]);
if (options){
options.tools=[
{ id: j,
iconCls:'icon-refresh',
handler:function(e)
{
console.log(e);
console.log(this);
console.log($(this));
}
}
];

var p = $('<div/>').attr('id',options.id).appendTo('body');
p.panel(options);
$('#ucPortal').portal('add',{
panel:p,
columnIndex:columnIndex
});
}
}
}

}
3  General Category / EasyUI for jQuery / Re: How to select all text in a combobox on focus on: October 06, 2015, 08:35:52 AM
Still doesn't seem to work on my system.....

Will this work on EasyUI 1.3.1 - I can't upgrade (at the moment) as there are a number of GUI issues that then appear :-/
4  General Category / EasyUI for jQuery / Re: How to select all text in a combobox on focus on: October 05, 2015, 05:10:44 AM
Nope, that doesn't seem to work at all. In fact if you use TAB to move between the multiple comboboxes (which *does* 'Select all'), clicking on one of them subsequently actually de-selects the text.

Sad
5  General Category / EasyUI for jQuery / How to select all text in a combobox on focus on: October 02, 2015, 05:25:58 AM
Hi All,

This is probably really simple, but I can't seem to work it out or find it via this forum...

Essentially I just want all of the text in a ComboBox to automatically be 'selected' when it receives focus. That way the user can just start typing without having to delete the existing content first.

Cheers,

Paul
6  General Category / EasyUI for jQuery / Re: Huge JSON tree on: October 08, 2014, 02:03:01 AM


This is exactly what I was looking for - Many thanks!   Smiley

For anyone else having the same issue, I simply implemented it using this method:-

$('#myTree').tree({loadFilter: myLoadFilter,....rest of parms....})
7  General Category / EasyUI for jQuery / Re: Huge JSON tree on: October 07, 2014, 11:50:40 AM
Unfortunately I can't use that method as the data is being returned from a 3rd party platform.

I have the entire tree as a JSON object - could you perhaps suggest a method for walking the JSPN object and asynchronously inserting the nodes via setTimeout() ?

There is approx. 10 nodes off the root, and ideally I'd like to async add each of these (and their children) - this would solve the issue for me.


 
8  General Category / EasyUI for jQuery / Huge JSON tree on: October 06, 2014, 07:46:14 AM
Hi,

I'm loading a very large JSON tree which is properly formatted into the tree control using the following line:-

$('#' + divId).tree('loadData',amTreeSource);

The fetching is ok, as is the sorting of the child nodes within the JSON data, but this can freeze the browser and throw up a 'script not responding' message.

How can I take this large JSON object and asynchronously pass it to .tree()  ?

Cheers,

Paul
9  General Category / EasyUI for jQuery / Re: Messager.prompt - Enter Key on: June 09, 2014, 03:07:59 AM
Solved it myself...

after the normal message.prompt code:-

Code:
 
$.messager.prompt("enter a number","number",function(r)
 {
  if(r)
   {
    // your code
    }
  });

Add this:-

Code:
$('.messager-input').bind('keypress', function(e) {
if(e.keyCode==13)
{
$('body div.messager-body>div.messager-button').children('a.l-btn:first-child').click();
}
}
);
10  General Category / EasyUI for jQuery / Messager.prompt - Enter Key on: May 30, 2014, 04:41:02 AM
Hi,

I know that the Enter key works by default for the messager.dialog, but I'd like it to fire off the function(r){} when I press the Enter key for messager.prompt (Input dialog) as well.

Any ideas?

Kindest regards,

Paul
11  General Category / EasyUI for jQuery / .dialog() seems to re-run previous jQuery.get() URL for no apparent reason ?! on: April 01, 2014, 02:39:15 AM
Hi,

I've been single-stepping through my javascript for a few hours now, and can't explain this....

I have a previous .get request that loads "http://127.0.0.1/assetmanager/pabx_templates.asp?run=1&silent=1&p=259&t=11&sites=124,228&_=1396345045548" (The URL is immaterial, but I'd thought I'd include it...)

Then when I click this button:-

Code:
<a class="easyui-linkbutton l-btn l-btn-plain" data-options="iconCls:'icon-csv', plain:'true'" href="javascript:asTemplates();">
<span class="l-btn-left">
<span class="l-btn-text icon-csv" style="padding-left: 20px;">Template Comparisons</span>
</span>
</a>

it calls this function:-

Code:
function asTemplates()
{

var h="<h2 class='repTitle'>Comparison Reports</h2>";
h+="<div class='FTable2 F8 FBlack FA_ML FB_White'>";
h+="<br>";
h+="<center>";
h+="<a href='javascript:$(\"#dlgGeneral\").dialog(\"close\");asEditTemplates();' class='makeMeAnEditButton'>Edit Template</a>";
h+="&nbsp;<a href='javascript:javascript:$(\"#dlgGeneral\").dialog(\"close\");asNewTemplate();' class='makeMeANewButton'>New Template</a>";
h+="&nbsp;<a href='javascript:javascript:$(\"#dlgGeneral\").dialog(\"close\");asRunTemplate();' class='makeMeARunButton'>Run Template</a><br>&nbsp;";
h+="</center></div>";
$('#dlgGeneralContent')[0].innerHTML=h;

$('.makeMeAnEditButton').linkbutton({iconCls:'icon-edit',plain:false});
$('.makeMeANewButton').linkbutton({iconCls:'icon-new',plain:false});
$('.makeMeARunButton').linkbutton({iconCls:'icon-play',plain:false});

$('#dlgGeneral').dialog({
width: 550,
height: 200,
closed: false,
cache: false,
modal: true,
toolbar: []
});

}

Which for no apparent reason, re-requests that URL again at the moment the Dialog box appears.

This isn't an April Fools' - It's driving me bloody mad....

12  General Category / EasyUI for jQuery / Re: Using .scroll, .scrollTop or .animate in a Dialog on a Tree (li/ul list) on: July 16, 2013, 12:45:18 AM
Thanks for the prompt reply.

Is this going to work within a .dialog? Only I'm not getting much joy even when implementing the code directly rather than extending Sad

Regards,

Paul
13  General Category / EasyUI for jQuery / Using .scroll, .scrollTop or .animate in a Dialog on a Tree (li/ul list) on: July 15, 2013, 05:57:18 AM
Hi,

I'm using a Dialog to show a 'tree', I've implemented a search function that finds and highlights the node, but I cannot work out how to ensure that it is visible (e.g. 'Scroll to') within a dialog.

I suspect this may be due to the fact that the tree is essentially li/ul combinations which don't expose an 'offset' or 'offsetTop' property within the DOM.

The search is achieved like so:

                  $('#myTree').tree('expandTo', node.target);
                  $('#myTree').tree('select', node.target)

And of course at this moment, the selected item is showing the 'tree-node-selected' class, so can be referenced via $('.tree-node-selected'), or more specifically; $('.tree-node-selected')[1] as there seems to be a ghost set of the same li/ui's created by the tree function of easyUI.

I've spent two whole days looking at this now, and am getting nowhere.

Any suggestions welcome at this point...

Cheers,

Paul

14  General Category / EasyUI for jQuery / Re: Tree search and Scroll to on: July 09, 2013, 03:02:44 AM
Nope... doesn't work. Is it because it is within a Dialog do you think?
15  General Category / EasyUI for jQuery / Tree search and Scroll to on: July 08, 2013, 08:40:15 AM
Hi All,

I've managed to implement a pretty functional 'search' facility for any easyUI tree, and I can get it to highlight and select the appropriate node.

What I can't do is see to get the jQuery .scrollTo to work with the div, ul or anything within the tree. I should point out that this tree is in a Dialog box (although I can't see that would make any difference)

Any help or suggestions on a viable ".scrollTo' implementation would be greatly appreciated.

Cheers!

Paul

Code:

function amTreeSearch(sInput, sTree)
{
var a=$('#' + sInput).val();
var node = $('#' + sTree).tree('getRoot');
var b=$('#' + sTree).tree('getData',node.target);

var node=search(b,a);
if(node)
{
$('#' + sTree).tree('expandTo', node.target);
$('#' + sTree).tree('select', node.target)
$('#' + sTree).scrollTo(node.target);
//$('#' + sTree).scrollTo(2000);  // This is just to test ... it didn't work either!
}
else
{
showWarning('icon-error','Error','Sorry, I could not find any matches');
}
}

function search(obj, name) {

var a=$('<div>' + obj["text"] + '</div>').text();
var x=a.toLowerCase().indexOf(name.toLowerCase()) != -1

if (x) {
//console.log('****FOUND IT*****');
return obj;
}
if (obj.children || obj._children) {
var ch = obj.children || obj._children;
for (var i = 0; i < ch.length; i++) {
var found = search(ch[i], name);
if (found) {
return found;
}
}
}
return false;
}
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!