EasyUI Forum
February 21, 2018, 07:48:23 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 10
 1 
 on: Today at 01:08:21 AM 
Started by Don_Juan - Last post by Don_Juan
I used a propertygrid into window.

 2 
 on: February 20, 2018, 07:23:41 AM 
Started by Don_Juan - Last post by proceno72
Are you talking about form fields? If so it'simple; you can try "validate" action of EasyUi form component

 3 
 on: February 20, 2018, 03:26:09 AM 
Started by Don_Juan - Last post by Don_Juan
Hi,
exist a function or similar that allow me to check all fields required are written?
My fields are different from each other (combobox, validatebox,...), but almost all, have required=true  as inside option.
If the check is ok ,proceed to write, otherwise expose a allert message when i click a linkbutton (to save information) (I Want to check at the end).

I thought about this solution:
  • Scroll through all the elements by checking if required ! = Undefined
  • Check if the field is written.(if != Undefined)

Code:
var rows = $('#details').propertygrid('getChanges');
for(var i=0; i<rows.length; i++){
   if(rows[i].hasOwnProperty('editor')) {
      if(rows[i].editor.options.hasOwnProperty('required')) {
         if(rows[i].editor.options.required && (rows[i].value==""))
            console.log("Required, without value! ALLERT!!!!");
         else
            console.log("Requested and completed");
      } else
         console.log("I do not care");
   } else
      console.log("I do not care");
}

The values I get with $('#details').propertygrid ('getChanges') are:

0: {…}
    editor: {…}
        options: {…}
            missingMessage: "No Field!"
            required: true
            validType: Object { length: […] }
            __proto__: Object { … }
        type: "validatebox"
        __proto__: Object { … }
    group: "Dettagli"
    index: 0
    name: "Name"
    value: ""
    __proto__: Object { … }

.....
5: {…}
    editor: {…}
        options: {…}
            validType: Object { length: […] }
            __proto__: Object { … }
        type: "validatebox"
        __proto__: Object { … }
    group: "Dettagli"
    index: 5
    name: "Tag"
    value: ""
....

Is there another way?
Thanks!

 4 
 on: February 20, 2018, 02:38:33 AM 
Started by Don_Juan - Last post by Don_Juan
Thanks so Much! Grin Grin
Now, Can I expose a message that advise me of the wrong insertion?

 5 
 on: February 20, 2018, 12:40:30 AM 
Started by argumentum - Last post by stworthy
Something likes this.
1. When select a file, don't upload it immediately, push it to the queue.
2. Call 'doUpload' function to start uploading a file in the queue.
3. When upload a file successfully, call 'doUpload' function again to upload another file.

Code:
var queue = [];
function uploadQueue(){
  $('#dlg').dialog('close');
  var row = $('#dg').datagrid('getSelected');
  var RowID = $('#RowID').val();
  var file = $('#file').filebox('files')[0];
  if (file){
    queue.push({
        RowID: RowID,
        row: row,
        file: file
    });
    if (queue.length == 1){
      doUpload();
    }
  }
}
function doUpload(){
    var url = 'upload.php';
    if (queue.length){
        var item = queue.shift();
        uploadFile(url, item.RowID, item.file, function(RowID, status, filename, message){
            //...
            doUpload(); // continue to upload
        });
    }
}

 6 
 on: February 19, 2018, 10:21:15 PM 
Started by argumentum - Last post by argumentum
The code you've shared is functional and does upload.

The 'RowID' field should be appended to the form to bind the uploading file with the selected row.
As far as I can see, the #RowID does not do anything, so, what is its purpose ?, I don't see the binding.
I assume I am to populate it with the the "db RowID", ..ok, so I can pass the value to my upload.php file. Got it.


Also, as I upload, they all upload concurrently, and part of the idea is having a queue to upload sequentially.
Is important for low bandwidth environments. Would you care to show how it can be queued up ?, I haven't had much luck imagining how to go about it.

Thanks for your patience with me stworthy, I know this question is outside jEasyUI support Smiley

 7 
 on: February 19, 2018, 09:44:28 PM 
Started by pratikk - Last post by pratikk
Can somebody help me ??

 8 
 on: February 19, 2018, 06:20:06 PM 
Started by Don_Juan - Last post by stworthy
Please try to set the 'limitToList' property to true to limit the inputing text within the list.

 9 
 on: February 19, 2018, 06:04:43 PM 
Started by argumentum - Last post by stworthy
The 'RowID' field should be appended to the form to bind the uploading file with the selected row.
Code:
<form enctype="multipart/form-data" id="ffUpload" name="ffUpload" method="post">
    <table border="0" style="width:100%">
        <tr>
            <input id="RowID" type="hidden" name="RowID">
            <input id="file" class="easyui-filebox" data-options="prompt:'Choose a file...'" style="width:100%"> </tr>
    </table>
</form>


 10 
 on: February 19, 2018, 09:37:26 AM 
Started by argumentum - Last post by argumentum
Define a function 'uploadFile' to upload the selected file. When start to uploading a file, update the selected row's status to 'uploading'. When uploading action is finished, update the row's status to 'finished'. Please refer to the code below:

Thanks stworthy. Reading the code I see that,
1, there is no error handling or handling of any returned value from upload.php and, (got that part in PS3*)
2, there is no queue list of files.

I find both features important. Could you show me how to code those.

Code:
// upload.php would return $response as:
$response["fileName"] = $fileName;
$response["message"] = 'OK';
$response["error"] = false;
echo json_encode($response);

so the function uploadFile would have something of the like:
Code:
if (xhr.status >= 200 && xhr.status < 300) {
succ(RowID, 'finished', fileName, message);
// and I'd like to get data back from the url
// that could be the fileName used, etc.,

} else {
succ(RowID, 'error', '', xhr.status);
// in case of not "xhr.status 2xx"
}

Thanks


PS: I'm using https://www.jeasyui.com/forum/index.php?topic=7052.msg18466#msg18466 as bases for my code.
I did not include it in the mockup as I thought it would not be needed.

PS2: I've added id="file" class="easyui-filebox" to have a $(#file), now,
in var RowID = $('#RowID').val();, could not find #RowID

*PS3:
Code:
if (xhr.readyState == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
var ret = JSON.parse(xhr.responseText);
succ(RowID, ret.message);
} else {
succ(RowID,'error ' + xhr.status);
// in case of not "return 2xx"
}
}



Pages: [1] 2 3 ... 10
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!