EasyUI Forum
March 29, 2024, 12:28:42 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: appendRow - how to add new record to "datagrid" ? on: January 15, 2022, 03:38:30 PM
this Question forms to my (later) Bug Report, today.
2  General Category / Bug Report / selektor + appendRow in a datagrid => only allow static content... on: January 15, 2022, 01:26:48 PM
Hello,

I try to make the static HTML structure a little bit dynamically.
So, I had tried the "appendRow" Function to append a row, and
fill the datagrid with text.

The getting of the text from the INPUT fields of a FORM placed
on a dialog, is not the problem.

The problem is, that easyui do not parse the function body of
embeeded code in the function call of "appendRow".

The Question is now:
How can I use variables, instead static code ?

// this function works !

function appendTableData(dg)
{
    alert('apppend');

    let t1 = 'firstnamedg'+dg;
    let t2 = 'lastnamedg' +dg;
    let t3 = 'phonedg'    +dg;
    let t4 = 'emaildg'    +dg;

    let s1 = $('#'+t1).textbox('getText').replace(/ $/g,"");
    let s2 = $('#'+t2).textbox('getText').replace(/ $/g,"");
    let s3 = $('#'+t3).textbox('getText').replace(/ $/g,"");
    let s4 = $('#'+t4).textbox('getText').replace(/ $/g,"");

    if (s1.length > 0)
        if (s2.length > 0)
            if (s3.length > 0)
                if (s4.length > 0)
                    $("#dg" + dg).datagrid('appendRow',{
                        'firstnamedg1': s1,
                        'lastnamedg1' : s2,
                        'phonedg1'    : s3,
                        'emaildg1'    : s4
                    });
}


// the following function content *do not* work !

function appendTableData(dg)
{
    alert('apppend');

    let t1 = 'firstnamedg'+dg;
    let t2 = 'lastnamedg' +dg;
    let t3 = 'phonedg'    +dg;
    let t4 = 'emaildg'    +dg;

    let s1 = $('#'+t1).textbox('getText').replace(/ $/g,"");
    let s2 = $('#'+t2).textbox('getText').replace(/ $/g,"");
    let s3 = $('#'+t3).textbox('getText').replace(/ $/g,"");
    let s4 = $('#'+t4).textbox('getText').replace(/ $/g,"");

    if (s1.length > 0)
        if (s2.length > 0)
            if (s3.length > 0)
                if (s4.length > 0)
                    $("#dg" + dg).datagrid('appendRow',{
                        'firstnamedg' + dg: s1,
                        'lastnamedg' + dg: s2,
                        'phonedg'     + dg: s3,
                        'emaildg'      + dg: s4
                    });
}


// this is an other coding style, that does not work with easyui !

function appendTableData(dg)
{
    alert('apppend');

    let t1 = 'firstnamedg'+dg;
    let t2 = 'lastnamedg' +dg;
    let t3 = 'phonedg'    +dg;
    let t4 = 'emaildg'    +dg;

    let s1 = $('#'+t1).textbox('getText').replace(/ $/g,"");
    let s2 = $('#'+t2).textbox('getText').replace(/ $/g,"");
    let s3 = $('#'+t3).textbox('getText').replace(/ $/g,"");
    let s4 = $('#'+t4).textbox('getText').replace(/ $/g,"");

    if (s1.length > 0)
        if (s2.length > 0)
            if (s3.length > 0)
                if (s4.length > 0)
                    $("#dg" + dg).datagrid('appendRow',{
                        t1: s1,
                        t2: s2,
                        t3: s3,
                        t4: s4
                    });
}


take a look to the three functions.
You can see, that the second, and third function differ from the first,
if You view the important "appendRow" part.

In a dynamically webproject, it is not possible to use variables and/or
placeholders.
Or did I something wrong?

I have tried these three functions, and do not come to a expected senario.

Thanks for helping Hands
3  General Category / EasyUI for jQuery / Re: to all elements/components of EasyUI -> how to hide, till all is render ... ? on: January 15, 2022, 05:07:51 AM
Hello,

I solved this own Question by learning, and doing by paste & use
based on SO:
https://stackoverflow.com/questions/8611713/running-javascript-after-page-is-fully-rendered

It works for me, as I had insert a second timeout.
The first timeout looks, if all functions and stuff is loaded.
The second timeout make sure, if the GUI stuff is rendered (for my Computer, 500 mmseconds are enough
and I think it is working fine).

Here comes the extended adapted code (form SO, and me):

Code:
<body>
...
<div preloader ...
/div>
<div easyui-window ...
...
/div>
...
<script language="JavaScript" type="text/javascript">
function highlighterAction() {
// do load page stuff here
}
function highlighter() {
    /*
      The short pause allows any required callback functions
      to execute before actually highlighting, and allows
      the JQuery $(document).ready wrapper to finish.
     */
    setTimeout(function() {
        highlighterAction();
    }, 200);
}
if (document.readyState == 'complete') {
    highlighter();

        // this timeout, i have add
setTimeout(function() {
$("#preloader").hide();
$("#win").window({closed:false});
}, 500);
} else {
    document.onreadystatechange = function () {
        if (document.readyState === "complete") {

            highlighter();
                // this timeout, I have add
setTimeout(function() {
$("#preloader").hide();
$("#win").window({closed:false});
}, 500);
        }
    }
}
</script>
</body>
</html>

HTHO - Hope This Helps Others
...
4  General Category / EasyUI for jQuery / to all elements/components of EasyUI -> how to hide, till all is render ... ? on: January 15, 2022, 04:21:57 AM
Hello,

My WebPage goes very big Project.
And therefore, the loading times goes to open sky limit.
This means, that I can see, what Elements/Objects are
loading at init. time.

I have implement a pre-loader screen.
But this screen will be disappear while the jquery function
$(document).ready( ...
is done.
This means, that the pre-lloader at end of this function is
hide to fast, and I can see the rendering of easyui.

I have tried to create a super-parent html "div", with the
style attribute "display:none;", and "visibility:hidden;".
But all this has no Effect.

So, the Question is: give it a Property or Function, that
can be used, after all is rendered on page.
When this is done/true, hide the ore-loader "div", and
display the content...

??
5  General Category / EasyUI for jQuery / appendRow - how to add new record to "datagrid" ? on: January 15, 2022, 01:25:29 AM
Hello,

how the topic say's: "How to add new record to "datagrid" ?
I have this little function (code below), I have static code, to
init. fill the datagrid (columns, data properties are set, and
then datagrid is shown without error's).

Then I open a dialog, press save button, that calls saveUser.
The "alert" box in the middle is shown, and display the right
message/value from the form's input value.
But future more at code, it would be add a empty record.

So, the question is: "How to add data to the new record ?"
For assistance, and helping hands, are welcome.
Thank You ver much...

Here is the code, that I have so far away...

Code:
function saveUser(dg)
{
let row2, idx2, dg2;
let frm2 = "";

$("#fm"+dg).form('submit',{
iframe: false,
success: function(result)
{
row2 = $('#dg'+dg).datagrid('getSelected');
idx2 = $('#dg'+dg).datagrid('getRowIndex',row2);

let t1 = 'firstnamedg'+dg;
let t2 = 'lastnamedg' +dg;
let t3 = 'phonedg'    +dg;
let t4 = 'emaildg'    +dg;

let s1 = $('#'+t1).textbox('getValue').replace(/ $/g,"");
let s2 = $('#'+t2).textbox('getValue').replace(/ $/g,"");
let s3 = $('#'+t3).textbox('getValue').replace(/ $/g,"");
let s4 = $('#'+t4).textbox('getValue').replace(/ $/g,"");

alert(t1 + '\n' + s1);
$('#dg'+dg).datagrid('appendRow',{
t1: s1,  t2: s2,
t3: s3,  t4: s4
});

$('#dlg'+dg).dialog('close');        // close the dialog
}
});
}

6  General Category / EasyUI for jQuery / css overflow only in right-bottom case - possible for left up scroll bars ? on: December 31, 2021, 05:13:29 AM
Hello,
like the topic says: Is it possible to have a scroll-bar at the upper-left position,
when a easyui component like "window" is moved around the view port of the
scene ?
I realize that, when css: overflow is set to "auto", only right-bottom scroll-bar
will be appear when the window is moved out of the dimensions.

A little demo is welcome.
Thanks in Advance
7  General Category / EasyUI for jQuery / Re: load php page from server and refresh the content of window (does not work) on: December 31, 2021, 05:08:39 AM
Hello,
I did coded a complicated "reload", and it works fine with one html file, and one window.
When I need more windows, I can place them in the "load" file, since JS is global with
"var" declarations.
It works not 100 percent perfectly, but it does his job.
8  General Category / EasyUI for jQuery / Re: easyui with ace.io - absolute positioning does not work properly on: December 31, 2021, 05:06:26 AM
Hello jarry,
Thank You for Your reply. I found my Error, and it work.
9  General Category / EasyUI for jQuery / easyui with ace.io - absolute positioning does not work properly on: December 30, 2021, 09:00:58 PM
Hello,
I would use easyui with integrated editor like ace.io. But I fail - some of the code is wrong - can You help ?
Here is the Code (it is a php file, but you could remove the php parts):
https://dpaste.com/6SDVC3KC7

Thanks in Advance
paule32

P.S.: I marked the position on which I have no glue (lines: 111, ff.)
10  General Category / EasyUI for jQuery / Re: load php page from server and refresh the content of window (does not work) on: December 28, 2021, 05:42:27 PM
Hello,

this is a snippet, extracted from my sources, to demonstrate a bug... ?
Bellow, You can see the file test.php:
on one click on a button/icon, the window will open, and work well.
on second click on the same button/icon, i get:

TypeError $(...).window is not a function

in file dummy.js:
if have a helper function, that should help, to prevent load the same stuff:
function page_loaded_init() { /* dummy */ }

/* this is test.php: */
function add_icon(func)
{
   $('#icon").dblclick(function(){
      if (typeof window["page_loaded_init"] == 'undefined') {
      func();
      $.parser.parse();
      }
      else {
      $("#win_Mathematik").window('refresh');
      $.parser.parse();
      }
   });
}

$(document).ready(function()
{
   add_icon(function() {
      let data = ""
      + "<div id='win_Mathematik' class='easyui-window' "
      + "data-options='title:\"Mathematik\",inline:true,"
      + "href:\"/pub/desk/apps/edumath/test.php\","
      + "onClose:function(){window[\"page_loaded_init\"] = undefined;page_loaded_init=undefined;return;}'  "
      + "style='width:325px;height:140px;padding:5px;'>"
      + "blub"
      + "</div>";
      $("#WindowsDesktop")
      .append(data);
   });
}

Is it a bug, or do I something wrong?
Thanks for feedback

paule32
11  General Category / EasyUI for jQuery / Re: load php page from server and refresh the content of window (does not work) on: December 28, 2021, 04:09:28 PM
Hello,

I could locate the line:

...
var opts = $('win_' + name).window('options');
console.log(opts.closed);
...

its the first line of this text above.
The Error Message occurs, when I try to open the same window (id, class, content, ...)

Named Error-Message is in FireFox:

Uncaught TypeError: $(...).window is not a function
...
...
...

can you help ?
thanks
12  General Category / EasyUI for jQuery / load php page from server and refresh the content of window (does not work) on: December 28, 2021, 11:18:32 AM
Hello and very nice holidays,

I have the following php (html) code: (test.php) https://dpaste.com/AREZGVRVV

the file is loaded at a jquery div dblclick event handler, and I place the
data into a easyui-window via:

$('#win_1').window({href:'/test.php'});
$('#win_1').window('refresh');

All works fine in "one" stage - means: when I open the file twice, I get error messages
into the console.log, and the web application stops.

Plain raw html stuff works fine, but I have some javascript's, and css styles within the
test.php file.
And these files, I would be load, too, to work with the function's, and the content.

I don't want to load all js, and css stuff at load time, because I sit on a bigger project,
so load time is very important.

My Question is now: how can I "unload" scripts, to open window/panel more than one times
so, that the contents will be handled correctly by the browser.

It would be great, if You can give some tips, and a little demo.

Thank You in advice
paule32
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!