Jump to content

Recommended Posts

Posted

In my app, when a user connect to the app, there is many configuration for his environment.

i have a code that is is like this :

if userconnnect = true then
begin
  LoadMainGridtitle; //set column title with user value
  LoadMaingridColumnconf; //size, position, hidden...
  LoadMaingridFilter;// load saved filter value and apply
  LoadMainGridSort;
  
  LoadRightPanelConf;  // size ans collapse state
  if  not panelRight.collapsed then 
    LoadFrameTree;//create frame TFrmTree and Assign to panel
  LoadLeftPanelConf;
  if  not letfRight.collapsed then
    LoadFrameForLeftPanel;
.....
end;

All this code generate a big js (700ko) that is send to client by unigui but during this generation the client don't see anything move in front of his eyes.

 

i would like do a thing like this but i not sure it is the best and the simple way. What do you think ?

  LoadMainGridtitle; //set column title with user value
--->>send to client for apply in client side
  LoadMaingridColumnconf; //size, position, hidden...
--->>send to client for apply in client side
  LoadMaingridFilter;// load saved filter value and apply
--->>send to client for apply in client side
  LoadMainGridSort;
--->>send to client for apply in client side

What is the best way to do this ?

 

i think a thing like but is it a good way and is it the simple way ?

  if user.connectd then
  begin
  LoadMainGridtitle; //set column title with user value
  unisession.addjs('ajaxrequest('+mainform.jsname',"LoadCustomConf",[value=1]');
  end;
......
procedure tmainform.UniFormAjaxEvent(Sender: TComponent; EventName: string;
      Params: TUniStrings);
begin

if eventname = 'LoadCustomConf' then
begin
  if params.values['value']=1 then
  begin
      LoadMaingridColumnconf; //size, position, hidden...
      unisession.addjs('ajaxrequest('+mainform.jsname',"LoadCustomConf",[value=2]');
  end;
  if params.values['value']=2 then
  begin
        LoadMaingridFilter;// load saved filter value and apply
      unisession.addjs('ajaxrequest('+mainform.jsname',"LoadCustomConf",[value=3]');
  end;
  ........
end;


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...