Another problem with filter .
I'm trying with remote database and datagrid is with 3 plugins :
<script src="jeasy/jquery.min.js"></script>
<script src="jeasy/jquery.easyui.min.js"></script>
<script src="jeasy/datagrid-filter.js"></script>
<script src="jeasy/datagrid-scrollview.js"></script>
<script src="jeasy/datagrid-cellediting.js"></scrip>
<script id="script-lang" src="jeasy/locale/easyui-lang-lt.js"></script>
<script src="jsf/func.js"></script>
<script src="jsf/grd.js"></script>
I alreday asked , how to disable cellediting in one click. It's working OK. But now I'm trying to do filtering with text field withouts operations after cell editing ( also tried and with other filters - the same ) ... Begining typing I'm seeing that again open editor on just edited cell and mine keyword is going here , not in filter text ...
It seems that mine update solution isn't fully functional .. Please , correct me , what I must to do. I'm using only 'onAfterEditing' event :
this.create_grid = function() // "this" here - created own object storing info about grid columns and own parameters ...
{
var obj = this;
var ret =
{
fit : true,
idField : this.pagr_rakt,
columns : [ this.grid_stulp ],
toolbar : [
{
id : 'naujas',
text : 'Naujas',
iconCls: "icon-add",
plain : true,
handler: function(){ $.messager.alert( "naujas" ); } //$( '#dg' ).datagrid( 'addRow' ) }
},
{
id : 'salint',
text : 'Šalinti',
iconCls: "icon-remove",
plain : true,
handler: function(){ $.messager.alert( "salinti" ); }
},
{
id : 'saugot',
text : 'Išsaugoti',
iconCls: "icon-save",
plain : true,
handler: function(){ $.messager.alert( "issaugoti" ); }
},
{
id : 'atmesti',
text : 'Atmesti',
iconCls: "icon-undo",
plain : true,
handler: function(){ $.messager.alert( "atmesti" ); }
}],
view : scrollview,
striped : true,
pagination : false,
pageSize : this.pusl_dyd,
singleSelect : false,
autoRowHeight : false,
remoteFilter : true,
remoteSort : true,
multiSort : true,
clickToEdit : false,
dblclickToEdit: true ,
url : format_url( this, "get" ),
onAfterEdit : function( index, row, changes )
{
//row.editing = false;
cell_update( index, row, changes, obj, this );
}
}
return ret;
}
function cell_update:
function cell_update( index, row, changes, obj, dg )
{
var laukai = Object.keys( changes );
var laukas = laukai[ 0 ];
var reiksm = changes[ laukas ];
var snd = "phpf/" + obj.grid_url + "?tbl=" + obj.pagr_lent + "&idf=" + obj.pagr_rakt + "&idk=" + row[ obj.pagr_rakt ] + "&cmd=upd&lks=" + laukas + "&var=" + reiksm +
"&fld=" + obj.lauku_eil + ( obj.rysio_eil ? "&jon=" + obj.rysio_eil : "" ); // update query to php ...
var ret = ajax_get( snd );
if ( ret.status != 'success' )
alert( ret.message );
else
{
var upd = 0; // check if other related field updated or not
var rec = ret.rows;
for ( var u in obj.grid_stulp )
{
var lks = obj.grid_stulp[ u ].field;
if ( rec[ 0 ][ lks ] != row[ lks ] )
{
row[ lks ] = rec[ 0 ][ lks ];
upd ++;
}
}
if ( upd > 0 ) // if returned record differs from existing row - update
dg.datagrid( 'updateRow', { index: index, row: row } );
}
}
It seems that this cell update is related to typing for filters ...
Another question - exist possibility to translate filter menu operations ? ( equal, contains ... )
Many thanks in advance ...