Jump to content

delagoutte

uniGUI Subscriber
  • Posts

    587
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by delagoutte

  1. Hi,

    "Good" news i can reproduce the probleme in a sample project

    launch the project( firebird database is in app directory\) click on button "connect" and you will have the error.

    remove the column WO_ORDER and you don't have the error

    testcase_grow.zip

  2. hello,

    I am trying to reproduce the problem and I have reproduced it partially but not on the Unigui example projects. I will try to explain when the error message occurs.

     

    i have a TFDQuery with a query with many field including 2 stringfield and 1 integerfield that i want display in grid.

    1- i link the query (via datasource)to the grid and i add a column for one of both string field. test : ok, no error

    2-i add a editor unimemo to this column. test : ok, no error

    3-i add a second column for second string field with unimemo as editor. test : ok no error

    4-i add a third column for the integer field. test KO , grow:true error

     

    i try adding a unispinedit as editor for this third column without effect on the error

     

    in my case this third column is not very important in my app, so i remove it. For me, the problem is no longer blocking but i think there is a bug somewhere in the unigui framework.

  3. sorry but i can't reproduce in a sample project.

    i wasted to mutch time on this problem so i decide to not use the editor unimemo directly in grid but a unidbmemo link to the field that i want edit but there is an other problem :

    i go to the end of texte , suppr all the CRLF and post-> new CRLF is added

    dbmemo_crlf_add.gif

  4. it seems to be an internal unigui problem.

    how can i check that all is good in dpr, mainform, mainmodule, servermodule ... that could explain this error message

    if i use a uniedit -> no problem

  5. i can't reproduce in unigui sample project.

    i change my code for tying to find the problem (see gif attach to this message)

    now the query that is linked to grid is active := false;.

    i launch app -> no error

    i click a button that set query.active := false; query.active := true;

    -> error

    i click again on button or i click on refresh button on dbnavigator -> all is good i can past CRLF in cell.

     

    where can i search ? i don't have anything in clientevents i havegrid event oncolumnfilter, onclearfilters, onAjaxEvent

     

     

    grow_error.gif

    edit1 :  i try this :

    unlink dbgrid from the datasource

    add a new grid, link to datasource, create column launch app -> same error

  6. if i use unimemo as editor with or without displaymemo i have this error when i load data :

    : GridWordReplace:TUniDBGrid:Config Option: O245->grow:true<br/>is refering a previous request,<br/>it's not allowed in AJAX request or JS handler.<br/>Use equivalent Public Property or Method instead

     

    any idea ?

  7. i thought that but no,

    if i set display memo to true. i have a wordwrap on the cell if the text is too long but in the value of the cell/ the string not really contain a CRLF.

    and i copy a string that contain a CRLF, the CRLF is lost when i past in the cell

     

  8. Hello,

    if i copy a text with many line and i past it in a grid cell the CRLF are removed.

    how can ido to keep then ? a grid option that i don't konw ?

     

    sample : i copy

    "my text

    begin

    here"

     

    i past this text in the grid cell.

    the text in cell became "my text begin here"

  9. Hello,

    i must implement a function that must work on a selected text in a memo.

    for exemple if i have this in a unimemo

    1 - Montext1
    2 - Montext1
    3 - Montext1

    i select the text "Montext1" of the second line, i call a function that replace number from a string by @

    result :

    1 - Montext1
    2 - Montext@
    3 - Montext1

    how can i do a thing like this (the function that change the selected text must be in seerver side )?

     

  10. You could find a test case with the problem (line 165 of main.pas)

    in source code i add

    - old method AddFunctionToGrid that works but override all grid not only specified grid

    -new code AddFunctionToGridV2 that should not override all grid but only the specified grid but sort no longer works

    GridColumnSort.zip

  11. i try with is

        if AddCancelSort then
        begin
          aGrid.ClientEvents.ExtEvents.Values['reconfigure']:=
            aGrid.ClientEvents.ExtEvents.Values['reconfigure']+
            ' for (let i = 0; i<columns.length;i++){ '+
            '        columns[i].sort= function(a) {'+#13#10+
            '            var me = this;'+#13#10+
            '            var grid = me.up(''tablepanel'');'+#13#10+
            '            var ds = grid.store;'+#13#10+
            ''+#13#10+
            '            if (a==null && this.el.hasCls(''x-column-header-sort-DESC'')) {'+#13#10+
            '                var removeIndx = -1;'+#13#10+
            '                var activeIndx = me.getSortParam();'+#13#10+
            '                var i = 0;'+#13#10+
            '                var sortersCount = ds.sorters.items.length;'+#13#10+
            '                ds.sorters.items.forEach(function(s) {'+#13#10+
            '                    if (s._property === activeIndx) {'+#13#10+
            '                        removeIndx = i;'+#13#10+
            '                        //return false;'+#13#10+
            '                    };'+#13#10+
            '                    i++;'+#13#10+
            '                });'+#13#10+
            ''+#13#10+
            '                if (removeIndx != -1) {'+#13#10+
            '                    ds.sorters.removeAt(removeIndx);'+#13#10+
            '                    if (sortersCount > 1) {'+#13#10+
            '                        ds.load();'+#13#10+
            '                    } else {'+#13#10+
            '                        ajaxRequest(grid, ''sortClearAll'', []);'+#13#10+
            '                        ds.load();'+#13#10+
            '                    };'+#13#10+
            ''+#13#10+
            '                    grid.headerCt.setSortState();'+#13#10+
            '                };'+#13#10+
            '            } else {'+#13#10+
            '                this.callParent(arguments);'+#13#10+
            '            };'+#13#10+
            '            grid.setSortNumbers();'+#13#10+
            '        }'+#13#10+
            '}'+#13#10;
        end;

    but with this when i click on clumn header i have this error in console

    Uncaught TypeError: can't access property "apply", b is undefined
        callParent ExtJS
        sort http://localhost:8079/:1755
        ExtJS 26
        afterRender http://localhost:8079/uni-1.90.0.1564/ext-unicommon-min.js:9
        ExtJS 4
        constructor http://localhost:8079/uni-1.90.0.1564/ext-unicommon-min.js:9
        ExtJS 25

    hav you got an idea of the reason for this error ?

  12. Hello,

    i need expert extjs

    By default unigui gridcolumn sort have only 2 state when we click on column title : ascending, descending.

    i needed 3 state : ascending, descending; none

     

    for this  i use this code to add this feature to a grid :

    if AddCancelSort then
          begin
          aGrid.ClientEvents.ExtEvents.Values['viewready'] := aGrid.ClientEvents.ExtEvents.Values['viewready']+
          ''+#13#10+
          '    me.getColumnIndex = function(grid, dataIndex, delta) {'+#13#10+
          '        gridColumns = grid.headerCt.getGridColumns();'+#13#10+
          '        for (var i = 0 + delta; i < gridColumns.length; i++) {'+#13#10+
          '            if (gridColumns[i].dataIndex == dataIndex) {'+#13#10+
          '                return i;'+#13#10+
          '            }'+#13#10+
          '        }'+#13#10+
          '    };'+#13#10+
          '    '+#13#10+
          '    me.findColumnIndex = function(columns, dataIndex) {'+#13#10+
          '        var index;'+#13#10+
          '        for (index = 0; index < columns.length; ++index) {'+#13#10+
          '            if (columns[index].dataIndex == dataIndex) {'+#13#10+
          '                break;'+#13#10+
          '            }'+#13#10+
          '        }'+#13#10+
          '        return index == columns.length ? -1 : index;'+#13#10+
          '    };'+#13#10+
          ''+#13#10+
          '    me.setSortNumbers = function() {'+#13#10+
          {$IFDEF DEBUG}
         '                     console.log("'+agrid.Name+'-setSortNumbers"); '+#13#10+
         {$ENDIF}
          '        var sCount = me.store.sorters.getCount();'+#13#10+
          ''+#13#10+
          '        me.el.select(''small.sortnumber'').elements.forEach(function(el) {'+#13#10+
          '            $(el).remove()'+#13#10+
          '        });'+#13#10+
          ''+#13#10+
          '        me.store.sorters.items.forEach(function(s) {'+#13#10+
          '            var indx, col;'+#13#10+
          '            indx = me.getColumnIndex(me, parseInt(s._property), parseInt(delta));'+#13#10+
          ''+#13#10+
          '            if ( me.columnManager.columns != null){'+#13#10+
          '            var col = me.columnManager.columns[indx];'+#13#10+
          '            if (col) col.el.select(''.x-column-header-text'').elements[0].innerHTML += ''<small class="sortnumber"> ('' + sCount + '')</small>'';'+#13#10+
          '            sCount--;'+#13#10+
          '            }'+#13#10+
          '        });'+#13#10+
          '    };'+#13#10+
          ''+#13#10+
          '    me.resetSort = function() {'+#13#10+
          '        var activeIndx = currentHeaders.activeHeader.dataIndex;'+#13#10+
          '        var i = 0;'+#13#10+
          '        var sortersCount = me.store.sorters.items.length;'+#13#10+
          '        me.store.sorters.items.forEach(function(s) {'+#13#10+
          '            if (s._property === activeIndx) {'+#13#10+
          '                removeIndx = i;'+#13#10+
          '                return false;'+#13#10+
          '            };'+#13#10+
          '            i++;'+#13#10+
          '        });'+#13#10+
          ''+#13#10+
          '        if (removeIndx != -1) {'+#13#10+
          '            me.store.sorters.removeAt(removeIndx);'+#13#10+
          '            if (sortersCount > 1) {'+#13#10+
          '                me.store.load();'+#13#10+
          '            } else {'+#13#10+
          '                ajaxRequest(me, ''sortClearAll'', []);'+#13#10+
          '                me.store.load();'+#13#10+
          '            };'+#13#10+
          ''+#13#10+
          '            me.headerCt.setSortState();'+#13#10+
          '            me.setSortNumbers();'+#13#10+
          '        };'+#13#10+
          '    };'+#13#10+
          ''+#13#10+
          '    Ext.override(Ext.grid.column.Column, {'+#13#10+
          '        sort: function(a) {'+#13#10+
          '            var me = this;'+#13#10+
          '            var grid = me.up(''tablepanel'');'+#13#10+
          '            var ds = grid.store;'+#13#10+
          ''+#13#10+
          '            if (a==null && this.el.hasCls(''x-column-header-sort-DESC'')) {'+#13#10+
          '                var removeIndx = -1;'+#13#10+
          '                var activeIndx = me.getSortParam();'+#13#10+
          '                var i = 0;'+#13#10+
          '                var sortersCount = ds.sorters.items.length;'+#13#10+
          '                ds.sorters.items.forEach(function(s) {'+#13#10+
          '                    if (s._property === activeIndx) {'+#13#10+
          '                        removeIndx = i;'+#13#10+
          '                        //return false;'+#13#10+
          '                    };'+#13#10+
          '                    i++;'+#13#10+
          '                });'+#13#10+
          ''+#13#10+
          '                if (removeIndx != -1) {'+#13#10+
          '                    ds.sorters.removeAt(removeIndx);'+#13#10+
          '                    if (sortersCount > 1) {'+#13#10+
          '                        ds.load();'+#13#10+
          '                    } else {'+#13#10+
          '                        ajaxRequest(grid, ''sortClearAll'', []);'+#13#10+
          '                        ds.load();'+#13#10+
          '                    };'+#13#10+
          ''+#13#10+
          '                    grid.headerCt.setSortState();'+#13#10+
          '                };'+#13#10+
          '            } else {'+#13#10+
          '                this.callParent(arguments);'+#13#10+
          '            };'+#13#10+
          '            grid.setSortNumbers();'+#13#10+
          '        }'+#13#10+
          '    });'#13#10;
          end;

    this code works fine since many years but i just realize there is a failure in my code.

     in the end of this code i use Ext.override(Ext.grid.column.Column, {'+#13#10+.....

     

    but with this code i override all grids in my app and not only the grid that i want add the feature.

     

    how can i rewrite this part of code for not using Ext.override(Ext.grid.column.Column, {.... and apply only for the designated grid ?

×
×
  • Create New...