Jump to content

andyhill

uniGUI Subscriber
  • Posts

    1262
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by andyhill

  1. YES, I only fell for that once.

     

        cbLookUpItems: TUniComboBox; 
     

    ...


      //////////////////////////////////////////////////////////////////////////////
      cbLookUpItems:= TUniComboBox.Create(HiddenPanel); 
      cbLookUpItems.Name:= 'cbLookUpItems';
      cbLookUpItems.OnAjaxEvent:= cbLookUpItemsAjaxEvent;
      //
      cbLookUpItems.BeginUpdate;
      cbLookUpItems.Items.Clear;
      cbLookUpItems.Items.Add('');
      if UniMainModule.MyQuery1.Active then UniMainModule.MyQuery1.Close;
      UniMainModule.MyQuery1.SQL.Clear;
      UniMainModule.MyQuery1.Params.Clear;
      UniMainModule.MyQuery1.SQL.Add('SELECT Description '+
      'FROM Items '+
      'WHERE HideFromView <> TRUE '+
      'ORDER BY Description ;');
      UniMainModule.MyQuery1.Open;
      while not UniMainModule.MyQuery1.Eof do begin
        cbLookUpItems.Items.Add(Trim(UniMainModule.MyQuery1.FieldByName('Description').AsString));
        UniMainModule.MyQuery1.Next;
      end;
      UniMainModule.MyQuery1.Close; // 209 items added
      cbLookUpItems.EndUpdate;
      //
      cbLookUpItems.OnCloseUp:=     cbLookUpItemsCloseUp;
      cbLookUpItems.OnChange:=      cbLookUpItemsChange;
      cbLookUpItems.OnChangeValue:= cbLookUpItemsChangeValue;
      //cbLookUpItems.OnSelect:=      cbLookUpItemsSelect;
      //
      cbLookUpItems.ClientEvents.ExtEvents.Clear;
      MyScript:= 'beforeselect=function beforeselect(combo, record, index, eOpts)'#13#10 +
                 '{'#13#10 +
                 '  ajaxRequest(MainForm.cbLookUpItems, '#39'_beforeSelect_'#39', []); '#13#10 +
                 '} ';
      cbLookUpItems.ClientEvents.ExtEvents.Add(MyScript);
      //
      MyScript:= 'select=function select(combo, record, eOpts)'#13#10 +
                 '{'#13#10 +
                 '  ajaxRequest(MainForm.cbLookUpItems, '#39'_Select_'#39', ["r="+record]); '#13#10 +
                 '} ';
      cbLookUpItems.ClientEvents.ExtEvents.Add(MyScript);

     

    ALL EVENTS SHOW

    TEXT ''

    ITEMINDEX 0

     

  2. IDE fine, runtime creation ISSUE (even though events all fire) so need to pass TEXT SELECTION back in Params below

    MyScript:= 'select=function select(combo, record, eOpts)'#13#10 +
                 '{'#13#10 +
                 '  ajaxRequest(MainForm.cbLookUpItems, '#39'_Select_'#39', ["r="+record]); '#13#10 + PLEASE SHOW HOW TO SET CHOSEN DATA IN PARAM
                 '} ';
    cbLookUpItems.ClientEvents.ExtEvents.Add(MyScript);

  3. I am creating cbLookUpItems (as a grid editor) complete with data (showing when dropdown) and all events are firing.

    cbLookUpItems.OnChange:= cbLookUpItemsChange; (cbLookUpItems.Text always shows '' in events)
    cbLookUpItems.OnSelect:= cbLookUpItemsSelect; (cbLookUpItems.ItemIndex always 0)

    So added my own event

      MyScript:= 'select=function select(combo, record, eOpts)'#13#10 +
                 '{'#13#10 +
                 '  ajaxRequest(MainForm.cbLookUpItems, '#39'_Select_'#39', ["r="+record]); '#13#10 + PLEASE SHOW HOW TO SET CHOSEN DATA IN PARAM
                 '} ';
      cbLookUpItems.ClientEvents.ExtEvents.Add(MyScript);

    SAME
    cbLookUpItems.Text always shows '' in events
    cbLookUpItems.ItemIndex always 0

    Even added defer between change and select.

    Please advise - thanks

  4. Sherzod, on Grids created at runtime (in FormCreate) my runtime assigned events do not fire ?

    If Grids are added to the Form in the IDE and Events are set in the ClientEvents Editor they do fire.

    FormCreate
    grdSuppliers:= TUniDBGrid.Create(pnlInfo); (pnlInfo is a child of MainForm)

    // Show
    grdSuppliers.ClientEvents.ExtEvents.Clear;
    MyScript:= 'show=function show(sender, eOpts)'#10+
                 '{ '#10+
                 '  ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
                 '  ajaxRequest(MainForm.pnlInfo.grdSuppliers, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
                 '  ajaxRequest(MainForm.window, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
                 '  ajaxRequest(MainForm, ''_Showing_'', []); '+ (tried different ways - NEVER FIRES)
                 '} ';
    grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

    Please show me how to add 'Show' Event at runtime to a Grid created at runtime whose parent is pnlInfo - Thanks

  5. Can we please make Grid Hide/Show events work.

    MyScript:= 'show=function show(sender, eOpts)'#10+
               '{ '#10+
               '  ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+
               '} ';
    grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

  6. Sherzod, I tried to implement based on your suggestion 

              grdTest.JSInterface.JSCode(#1'.pagingBar.getComponent("supFilter").setIcon("images/navigator/filter-16.png"');

    FAILS, Error attached.

    I moved it out of grdTest AjaxEvent into MainForm AjaxEvent - same error

      //////////////////////////////////////////////////////////////////////////////
      if SameText('_SuppFilter_', EventName) then begin
              grdTest.JSInterface.JSCode(#1'.pagingBar.getComponent("supFilter").setIcon("images/navigator/filter-16.png"');
      end;

    Please advise - thanks

    Error-2.jpg

  7. I have the following button added to the Grid's Built-In Paging Bar

                 '    {'#13#10 +
                 '      xtype: '#39'button'#39','#13#10 +
                 '      icon: '#39'images/navigator/unfilter2.png'#39','#13#10 +
                 '      width: 24,'#13#10 +
                 '      height: 24,'#13#10 +
                 '      tooltip: '#39'Filter'#39','#13#10 +
                 '      handler: function() '#13#10 +
                 '      {'#13#10 +
                 '        ajaxRequest(sender, '#39'_Filter_'#39', []); '#13#10 +
                 '      }  '#13#10 +
                 '    },'#13#10 +
    ...

    Subject to logic, change image

    grdTest.JSInterface.JSCode --> icon: 'images/navigator/filter2.png'

    grdTest.JSInterface.JSCode --> icon: 'images/navigator/unfilter2.png'

    Please advise how I can change the icon image at runtime - Thanks in advance

  8. function window.afterrender(sender, eOpts)
    {
      var PhysicalWidth  = screen.width; 
      var PhysicalHeight = screen.height; 
      var ScreenWidth    = screen.availWidth; 
      var ScreenHeight   = screen.availHeight; 
      var BrowserWidth   = Ext.getBody().getViewSize().width; 
      var BrowserHeight  = Ext.getBody().getViewSize().height; 
      var BrwsrInnerWth  = window.innerWidth; 
      var BrwsrInnerHgt  = window.innerHeight; 
      var r              = window.orientation; 
      ajaxRequest(MainForm.window, '_Rendered_', ["r="+r, 
                                                  "ScreenWidth="+ScreenWidth,     "ScreenHeight="+ScreenHeight, 
                                                  "PhysicalWidth="+PhysicalWidth, "PhysicalHeight="+PhysicalHeight, 
                                                  "BrowserWidth="+BrowserWidth,   "BrowserHeight="+BrowserHeight, 
                                                  "BrwsrInnerWth="+BrwsrInnerWth, "BrwsrInnerHgt="+BrwsrInnerHgt 
                                                   ]); 
    }

     

    // ONLY FIRES bclose, cinfo, afterrender(not my one), resize
    procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
    begin

      //////////////////////////////////////////////////////////////////////////////
      if SameText('_Rendered_', EventName) then begin // NEVER FIRES
     

    Please advise - Thanks in advance

  9. procedure TMainForm.UniFormCreate(Sender: TObject);

    ...
      
      //////////////////////////////////////////////////////////////////////////////
      grdSuppliers.ClientEvents.ExtEvents.Clear;
      MyScript:= 'hide=function hide(sender, eOpts)'#10+
                 '{ '#10+
                 '  ajaxRequest(MainForm.grdSuppliers, ''_Hiding_'', []); '+
                 '} ';
      grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);
      //
      MyScript:= 'show=function show(sender, eOpts)'#10+
                 '{ '#10+
                 '  ajaxRequest(MainForm.grdSuppliers, ''_Showing_'', []); '+
                 '} ';
      grdSuppliers.ClientEvents.ExtEvents.Add(MyScript);

    ...

     

    // ONLY EVENTS FIRED data/load/columnresize
    procedure grdSuppliersAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);

    ...

      //////////////////////////////////////////////////////////////////////////////
      if SameText('_Hiding_', EventName) then begin // NEVER FIRES 
     

      //////////////////////////////////////////////////////////////////////////////
      if SameText('_Showing_', EventName) then begin // NEVER FIRES
     

    Please advise - Thanks in advance

  10. Yes Sherzod, the "dateValue=Ext.Date.parse" code above was perfect - thank you again.

    I understand that I can add my own NavigationBar but I prefer to use the auto-built-in PagingBar one that comes with the Grid Component (this reduces component count on large projects).

    I understand your MaxInt suggestion.

    In the future, can we get Sencha to allow the PagingBar to be shown even when the grid is not in Paged Mode (I control which buttons are shown and which buttons are hidden). Also an Auto-PageSize would be a nice addition.

    Thanks again.

  11. Yes, WebOptions:-

    Paged:= True;
    PageSize:= AUTO;

    Grid is auto-sizing via flex container, Screen real-estate varies, Grid.Row.Cell.Font's vary, I want the Grid fully populated with maximum number of rows.

    "Constantly re-calculating the Grid Size and Re-Setting the PageSize is just not elegant - plus rows are not always flush with Grid Footer (grid size / font sizing etc.) no matter how it is calculated"

  12. I have, see txt file above, extract below

    MyScript:= 'pagingBar.afterCreate=function pagingBar.afterCreate(sender)'#13#10 +
                 '{'#13#10 +
                 '  '#13#10 +
                 '  sender.add('#13#10 +
                 '  [ '#13#10 +

                 '    {'#13#10 +
                 '      xtype: '#39'tbseparator'#39#13#10 +
                 '    },'#13#10 +

                 '    {'#13#10 +
                 '      xtype: "datefield", '#13#10 +
                 '      fieldLabel: "", '#13#10 +
                 '      formatText: "Date", '#13#10 +
                 '      labelWidth: "0px", '#13#10 +
                 '      format: "d/m/Y", '#13#10 +
                 '      value: new Date(), '#13#10 +
                 '      id: "gridDate2", '#13#10 +
                 '      width: 120, '#13#10 +
                 '      startDay: 1, '#13#10 +
                 '      listeners: '#13#10 +
                 '      {'#13#10 +
                 '        change: function(el, v) '#13#10 +
                 '        {'#13#10 +
                 '          ajaxRequest(sender, '#39'_DateChange_'#39', ["dtIndx=0", "val=" + Ext.Date.format(v, "d/m/Y")]) '#13#10 +
                 '        }'#13#10 +
                 '      }'#13#10 +
                 '    },'#13#10 +
    ...

    Please advise how I can set the Grid's PagingBar DatePicker(id: "gridDate2") outside of Grid event.

  13. This is what I found, there are several grids and I wanted to sync all Grid DatePicker's value no matter which grid DatePicker was clicked, I did this by using the same DatePicker ID (I know it was naughty).

    Going back to unique DatePicker ID's - all good - except no date syncing.

    Please show me how to set/update the value of the DatePicker in each of the Grids PagingBar at runtime - Thanks.

    grdTest DatePicker id: "gridDate"

    grdTest2 DatePicker id: "gridDate2"

    etc.

    Thinking Out Aloud ???
    with grdTest2.JSInterface do begin
      with pagingBar.JSInterface do begin
        JSCall('getPicker().setValue', ['+MyDate+']);
      end;
    end;

    Please advise - Thanks

×
×
  • Create New...