Jump to content

fraxzi

uniGUI Subscriber
  • Posts

    237
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by fraxzi

  1. 12 hours ago, Sherzod said:

    Hello @fraxzi

    Let's start with some solutions.

    You can process it first on the client side to prevent it from collapsing if the grid is in the editing state.

    1. 

    procedure TDetailFrame.UniFrameDestroy(Sender: TObject);
    begin
     //Somewhere to prevent collapse of RowWidget if ClientDataSet has changes....???
     //MessageDlg('There Are Changes... Save Data Entry?', mtConfirmation, mbYesNoCancel, uMsgCallBack);
    end;

    2. MainForm.Script ->

    Ext.onReady(function() {
        Ext.override(Ext.grid.plugin.RowWidget, {
            toggleRow: function(rowIdx, record) {
                if (record && record.node) {
                    var _nestedgrid = Ext.get(record.node).query('.x-grid')[0];
                    if (_nestedgrid) {
                        var _editingPlugin = Ext.getCmp(_nestedgrid.id).editingPlugin;
                        if (_editingPlugin && _editingPlugin.editing === true) {
                            return false
                        }
                    }
                }
                this.callParent(arguments);
            }
        })
    })

     

    Hi @Sherzod,

     

    I tried the above. The RowWidget still collapse then the messagedlg (with callbackl) prompts.

    Would it be possible to disable the collapse button and enable it when needed?

    Thanks for the usual assistance.

    -Frances

     

  2. On 5/26/2022 at 11:42 PM, Sherzod said:

    Hello,

    Here is the solution:

    1. UniDBGrid1.ClientEvents.ExtEvents -> 

    function afterrender(sender, eOpts)
    {
        sender.view.rowExpander.collapseRow = function(rowIdx) {
            var rowNode = this.view.getNode(rowIdx),
                row = Ext.get(rowNode),
                nextBd = Ext.get(row).down(this.rowBodyTrSelector),
                record = this.view.getRecord(rowNode),
                grid = this.getCmp();
            if (!row.hasCls(this.rowCollapsedCls)) {
                row.addCls(this.rowCollapsedCls);
                nextBd.addCls(this.rowBodyHiddenCls);
                this.recordsExpanded[record.internalId] = false;
                this.view.fireEvent('collapsebody', rowNode, record, nextBd.dom);
            }
        };
    }

    2. 

      private
        { Private declarations }
        FPrevRowID: Integer;

    3. 

    procedure TMainForm.UniFormCreate(Sender: TObject);
    begin
      FPrevRowID := -1;
    end;

    4. 

    procedure TMainForm.UniDBGrid1RowExpand(Sender: TUniCustomDBGrid;
      const RowId: Integer; var RowControl: TControl; Container: TUniContainer);
    begin
      if FPrevRowID=-1 then
      begin
        FPrevRowID := RowId
      end
      else
      begin
        UniDBGrid1.JSInterface.JSCall('view.rowExpander.collapseRow', [FPrevRowID]);
        FPrevRowID := RowId;
      end;
    
      RowControl := TDetailFrame.Create(Container);
    
    end;

    5. 

    procedure TMainForm.UniDBGrid1RowCollapse(Sender: TUniCustomDBGrid;
      const RowId: Integer; Container: TUniContainer);
    begin
      if FPrevRowID=RowId then
        FPrevRowID := -1;
    
    end;

     

    Hi @Sherzod,

     

    I tried the above (as is) works well with on-screen rows (I am using .1579) but when I left an open widget and scroll down to open another row it prompts ajax error:

    image.png.e3a32435402a3e82554ff7e810630e91.png

     

    Also, in Grouped dbGrid, if I open row widget on, say, group 1 then open another widget from group 2, the widget willl not expand then the rest of the row widget wont open.

    Hoping for your assistance.

    Thanks,

    Frances

  3. On 1/18/2024 at 12:16 PM, Sherzod said:

    Hello @fraxzi

    Yes, you need to modify the code for this, there are several examples on the forum using the reconfigure function that can help you.

    You can analyze these examples and apply them in your project, I'll try later.

    Hi @Sherzod,

    I looked at all available post but still couldn't figure it out.

    Could you help me out please.

    Thanks,

    Frances

  4. On 2/22/2023 at 12:56 PM, Sherzod said:

    Solution for both cases:

    function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
    {
        var delta=0;
        if (columns[0].xtype && columns[0].xtype == 'rownumberer') {
            delta = 1;
        }
        var widgetColIndx = 1; //Index without regard to rownumberer
        columns[widgetColIndx + delta].onWidgetAttach = function(column, widget, record) {
            widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish");
        };
    }

     

    Hi @Sherzod,

    I tried this solution with Grouped dbGrid and I couldn't make it work like the one Not Grouped.

    Any suggestion?

    Thanks,

    Frances

  5. On 9/29/2023 at 2:56 PM, Sherzod said:

    Okay, you can try to use this approach:

    1. UniDBGrid1.ClientEvents.UniEvents ->

    function afterCreate(sender) 
    {
        sender.expandFirstGroup = function() {
            try {
                sender.getView().features[0].expand(sender.getView().features[0].dataSource.data.items[0].groupKey)
            } catch (err) {}
        }
    }

    2. Usage:

    procedure TMainForm.UniButton1Click(Sender: TObject);
    begin
      UniDBGrid1.JSInterface.JSCall('expandFirstGroup', []);
    end;

     

    Yes!!! @Sherzod, works like a charm!  Thanks much..

     

    • Thanks 1
  6. 15 hours ago, Farshad Mohajeri said:

    There are various methods to implement WebSockets on IIS. Which method have you preferred?

    Hi sir @Farshad Mohajeri

    In my case, I use IIS (https) and Hyperserver .. despite of carefully following the manual I still couldn't work it.. but in my DevtEnv (127.0.0.1) websocket is working (also the examples).. I am just saying.

    Kind regards,

    Frances

    • Upvote 1
×
×
  • Create New...