EasyUI Forum
May 15, 2024, 02:11:37 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1] 2
1  General Category / EasyUI for jQuery / how to add parameters to messager.alert callback? on: November 06, 2015, 01:05:03 PM
Hi,
I wrote this function to display/alert any number of messages.
I want to fire a callback, for every message, when the OK button is presed. So I wrote the second function: mssagerAlertCallBack.

Code:
function tjs1_muestraTodosLosMensajes (pMensaje) {
for (var i = pMensaje.length - 1; i>=0; i--) {
  var numMsjs = pMensaje.length;  var numMsj = i+1;  var mensaje = pMensaje[i];
  var titulo = "(Msje " + numMsj + "/" + numMsjs + ") - " + mensaje.msj_title;
  var oIcons = {"E" : "error", "Q": "question", "I": "info", "W": "warning"};
  var icon = oIcons[mensaje.msj_type];
  var win = $.messager.alert(titulo, mensaje.msj_text, icon, function(){
  if (typeof(mssagerAlertCallBack)==='function') mssagerAlertCallBack(numMsj,numMsjs,mensaje);
  });
  //win.window({closable:false});
}
}

    function mssagerAlertCallBack(numMsj,numMsjs,mensaje){
        console.log('numMsj=',numMsj,numMsjs,mensaje);
    }

I am testing with 5 messages.
The messager.alert display all messages ok, From 1 to 5.
But the mssagerAlertCallBack function displays allways the same data, variable numMsj never changes !?

I have tried some codes with no luck.
Please can you help me?

MTIA.
2  General Category / EasyUI for jQuery / Re: how to get the field name inside an styler function? on: June 18, 2015, 05:35:03 PM
Forget it guys, I was lost. It is so easy:
Code:
this.field
is the solution!!
 Embarrassed
Bye.
3  General Category / EasyUI for jQuery / how to get the field name inside an styler function? on: June 16, 2015, 06:49:42 PM
Hi:

I am adding some fields (31) to a datagrid. They are added dynamically depending on user inputs.
I want to use just one styler function for all the 31 fields, but I need the field-name to make decisions inside the styler code.

The styler function recives only three parameters:
 value: the field value.
 rowData: the row record data.
 rowIndex: the row index.

How can I send the field-name?
I have tried the next with no luck:

Code:
    function modificaGrid(){
    var numDias = $('#inpDiffDays').val();
        var jsDate = js2_parserDate( $('#inpFechaD').datebox('getValue') );
        var newCols = [];
        for (i=1;i<=numDias;i++) {   /* numDias = 31 */
            var campo = 't-eh-&1'.replace('&1',i);
            var diaAlfa = js2_weekDay(jsDate);
            var title = '&1 &2-&3'
                .replace('&1',diaAlfa.substr(0,2))
                .replace('&2',('0'+(jsDate.getMonth()+1)).slice(-2))
                .replace('&3',('0'+jsDate.getDate()).slice(-2));
            var col = {
                    field:campo, title:title, width:60, align:'center',
                    styler:function(value,row,index){ console.log('inside styler: ', campo);
                               local_tehStyler(value,row,index,campo);
                     },
                     /* here: campo inside styler  = the last value (t-eh-31), but every field value is OK!! */
                };
            newCols.push(col);
            jsDate = js2_addDaysToDate(jsDate,1);
        }
        var cols = g_dfltCols.concat(newCols); newCols=[];
        console.log(cols);
        $('#dg').datagrid({columns:[cols]}); cols=[];
    }

with this code:
Code:
   styler:function local_tehStyler(value,row,index,campo){console.log('inside styler: ', campo);},
the campo is undefined!

The styler function is something like:
Code:
function local_tehStyler(value,row,index,campo){
        var numColor = null;
        console.log(campo);
        var numField = last-part-of-the-field-name(campo);
        var anotherField = 't-por-&1'.replace('&1',numField);
        var tpor = row[anotherField];
        if (tpor=='R') numColor=14; else if(tpor=='W') numColor=6; else if (tpor=='M') numColor=12
        else if(tpor=='O') numColor=13;
        return 'background:&1;'.replace('&1',js1_traduceNumColor(numColor));
      }

MTIA.
4  General Category / EasyUI for jQuery / Re: How to change the combobox border-color? on: March 11, 2015, 06:51:24 PM
Thanks a lot stworthy!!
5  General Category / EasyUI for jQuery / How to change the combobox border-color? on: March 10, 2015, 06:22:06 PM
This line works fine!
Code:
$('#filtroAv').css("border-color", "red");
This line does'nt works!
Code:
$('#inpField').css("border-color", "red");

The second line is for a combobox.

Code:
        <input id="inpField" class="easyui-combobox" style="width:100px;"
            data-options="valueField:'clave',textField:'etiqueta',panelHeight:100,
                data:[
                    {clave:'r-apellido',etiqueta:'Apellidos(s)',selected:true},
                    {clave:'r-nombre',etiqueta:'Nombre(s)'},
                    {clave:'r-confirmacion',etiqueta:'Confirmación'},
                    {clave:'r-nreser',etiqueta:'Folio',tipoDato:'integer',tipoBusqueda:'unica',},
                ], value:'r-apellido',onSelect:cbOnSelect,validType:'inList',selectOnNavigation:true,"
        ></input>
       <a href="javascript:void(0)" id="filtroAv" class="easyui-linkbutton"
            iconCls="icon-search" onclick="openDialogFiltro()">Avanzada</a>

MTIA.
Fernando.
6  General Category / EasyUI for jQuery / How to display new lines in messager plugin? on: March 03, 2015, 04:48:31 PM
When next code runs I would like to see 3 lines of text in the messager box.
But just I see the three text messages in 1 line.
Can you help me please?

Code:
 else {
        var errMsg = '';
        if (g_agenciaInvalida) { errMsg = errMsg + ((errMsg=='')?'':'\n') + 'Agencia Invalida!!!'; }
        if (g_empresaInvalida) { errMsg = errMsg + ((errMsg=='')?'':"\n") + 'Empresa Invalida!!!'; }
        if (g_grupoInvalido)   { errMsg = errMsg + ((errMsg=='')?'':'\r') + 'Grupo Invalido!!!'; }
        if (errMsg!='') { $.messager.alert('Error', errMsg, 'error'); }
        else { regresaDatos(); }
    }
7  General Category / EasyUI for jQuery / Re: disabled numberbox elements issue on: July 30, 2014, 08:43:47 AM
I did it, but it does not work!
In fact, I show the disabled attribute of this element
Code:
console.log($('#inpNumCampos').attr('disabled'));
just before the form submit, and it is disabled!!
8  General Category / EasyUI for jQuery / disabled numberbox elements issue on: July 29, 2014, 10:23:11 AM
disabled numberbox elements still send their value to server when  submit the form
Code:
<input name="numCampos" id="inpNumCampos" class="easyui-numberbox" maxlength="6" style="width:40px" disabled value ="20">
<input name="numUsers" id="inpNumUsers"  maxlength="6" style="width:40px" disabled value="5">
the second one element works like supposed to be, but the first one still send its value on submitting form.
I tried different ways of disabling the element with no luck!

The form is pre-loaded with:
Code:
$('#fm').form('reset');

need I to specify something else in the numberbox plugin?

MTIA Guys!!

9  General Category / EasyUI for jQuery / How to know if a tab is enabled/disabled? on: May 09, 2014, 10:24:27 AM
Hi,
In easyui-tabs class, How to know if a particular tab is enabled/disabled?

Let's say :
Code:
 
var enabled = $('#tt').tabs('isEnabled', tabIndex);
or
var disabled = $('#tt').tabs('isDisabled', 'tabTitle');

MTIA.
10  General Category / EasyUI for jQuery / Re: Issue when disabling input elements of a form on: March 13, 2014, 11:14:38 AM
Thanks stworthy.

The extended 'disable' method works fine !!

Now, I'm facing another issue...
How can I enable/disable the easyui-searchbox? I mean enable/disable the "searchbox-button", the textbox part is not the problem.

Tanks in advance.

11  General Category / EasyUI for jQuery / Issue when disabling input elements of a form on: March 07, 2014, 11:59:12 AM
Hi !

I need to disable a form. So, I'm trying to disable all input elements.
Code:
$("#fm :input").prop("disabled", true);
It's ok for "basic" elements, easyui-validatebox and easyui-numberbox but it fails for easyui classes like easyui-combobox, easyui-datebox and easyui-searchbox.
The text-box part is disabled as expected but the arrow-box part is active yet!!

Disabling combo-boxes and date-boxes with its methods
Code:
$('#inpPt').combobox('disable'); $('#inpFeDesde').datebox('disable');
all goes ok! (full element is disabled)

I have many combo and date boxes, so I would not like to disable one by one or traversing all input elements for checking its class type and apply the corresponding method.

How can I extend (if it's possible) the combo and date classes so they can be proper disabled?

Thanks for your help!
12  General Category / EasyUI for jQuery / Re: how to bind a keyup function to searchbox? on: December 16, 2013, 08:49:46 AM
Ok,
I had that line of code to the end of the $(function() , so i moved it just after the $(function() definition line, and Yes, it Works now!!

Please, how can I get the searchbox magnifier ?

Thanks again!!
 
13  General Category / EasyUI for jQuery / how to bind a keyup function to searchbox? on: December 13, 2013, 11:54:02 AM
Hi.
I'm using a searchbox as a continuous filter box.
I mean: On every key typed in the searchbox the content's datagrid is filtered.
I need to resolve two issues:

1) How to bind a keyup function to searchbox?

This is the searchbox
Code:
    
<input id="inpSearch2" class="easyui-searchbox" style="width:250px"
        data-options="prompt:'Tecleé aquí lo que deseé filtrar.'"></input> 

I have tried this:
Code:
  $('#inpSearch2').searchbox('textbox').keyup(function () { lk2_filtroLocal(this,'dg'); });
and this:
Code:
  $('#inpSearch2').bind('keyup',function(){alert('hola')});   
with no luck.

2) How to get the searchbox button (magnifier glass) to disable it?

Please can you help me?
MTIA.
14  General Category / EasyUI for jQuery / Re: Issue with datagrid endEdit method on: October 31, 2013, 12:03:05 PM
Thanks for your help!

Because the rows in datagrid can be changed many times before they are send to server.
Example:
a row (r) has a field 'f1' with value 'xyz'. It's changed so the new value is '123'.
After changing other rows, I change my mind and change again the row (r) so now, the "new" value is 'xyz'.
the datagrid('getChanges') counts the row (r) as changed but it doesn't changed really.
I want to send to server only the rows really changed.
To solve it, I figured out make a "picture" of the original rows and check against it.

Now, ooopsss!!!, I found javascript copies objects and arrays as a kind of "by reference",
so the copy of data.rows
Code:
data.orgRows = data.rows;
was not a real/self-contained copy.

So, I had to use this line of code to make two different objects:
Code:
data.orgRows = $.extend(true, {}, data.rows);
and everything is working ok .... until now!!  Smiley Smiley

Thanks again and so long!
15  General Category / EasyUI for jQuery / Issue with datagrid endEdit method on: October 30, 2013, 09:28:25 AM
Hi Srs:

I'm using an in-line edit datagrid.
When all changes are made, I'm trying to get the datagrid changed rows with next function:

  function aceptaCambios() {
      // var rowsCh = $('#dgP').datagrid('getChanges');
      // console.log(rowsCh.length, rowsCh);
      var rowsChanged = [];
      var originalRows = $('#dgP').datagrid('getData').orgRows;
      console.log(originalRows[3]['p-vp']);
      var rows = $('#dgP').datagrid('getRows');
      $.each(rows, function(indx,row) {
          var rowChanged = false;
          var orgRow = originalRows[indx];
          console.log(row['p-vp'], orgRow['p-vp'], row['p-gp'], orgRow['p-gp']); 
          if (row['p-vp'] != orgRow['p-vp']) rowChanged = true;
          if (row['p-gp'] != orgRow['p-gp']) rowChanged = true;
          if (rowChanged) rowsChanged.push(row);
      });
      console.log(rowsChanged.length, rowsChanged);
      // $('#dgP').datagrid('acceptChanges');
  }     

The issue is: The field values of row are equal to values in orgRow data (original rows) so rowChanged variable never becomes true.

The originalRows data are copied at end of the loadFilter function of datagrid.

function grid_loadFilter(data) {
    ...
    ...
      if (this.id == "dgP" && !data.orgRows) {
         data.orgRows = data.rows;
         console.log('loadData row = 3', data.orgRows[3]['p-vp']);   // tracking
      } 
      return data;
}

After tracking the issue, I found the datagrid 'endEdit' method seems to be the culprit.

function cambiaRow(indx){
      var originalRow = $('#dgP').datagrid('getData').orgRows[indx];
      console.log('cambiaRow Start: row =', indx, originalRow['p-vp']);         

      $('#dgP').datagrid('beginEdit', indx);
      $('#dgP').datagrid('selectRow', indx);

      originalRow = $('#dgP').datagrid('getData').orgRows[indx];
      console.log('cambiaRow End: row =', indx, originalRow['p-vp']);         
  }
 
  function aceptaRow(indx){
      var originalRow = $('#dgP').datagrid('getData').orgRows[indx];
      console.log('aceptaRow Start: row =', indx, originalRow['p-vp']);         

      $('#dgP').datagrid('endEdit', indx);
      $('#dgP').datagrid('selectRow', indx);   

      originalRow = $('#dgP').datagrid('getData').orgRows[indx];
      console.log('aceptaRow End: row =', indx, originalRow['p-vp']);         
  }
 
This are the console tracking messages: (I'm tracking the original data for updated row = 3)
loadData row = 3 No                w-usr-grp.html# (línea 269)
cambiaRow Start: row = 3 No        w-usr-grp.html# (línea 294)
cambiaRow End: row = 3 No          w-usr-grp.html# (línea 298)
aceptaRow Start: row = 3 No        w-usr-grp.html# (línea 306)
aceptaRow End: row = 3 Si          w-usr-grp.html# (línea 310)

As You can see, After "endEdit" method, not only the data.rows are changed, the original-data copy is changed too!!
Is this a issue or am I loosing something?

I tried copying the original data to a JavaScript variable out-of the datagrid data and the same behaviour is shown.
 
Please can you help me?

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