Jump to content

UniStringGrid Blank spaces


Gabriel

Recommended Posts

Hi, 

I'm having an issue with the unistringgrid. I'll try to explain.

I'm using a UniStringGrid so the user can enter some data (as detailed here http://forums.unigui.com/index.php?/topic/11309-solved-unistringgrid-editorview), which works great, but i'm having trouble saving the information to a text file, the problem is that the grid trims the blank spaces at the beginning of the cell but only when i add them myself.

 

Some images:

When i load the app and press the button show text:

 

blob.png.bf41fb34b159d1eead4f628de495a492.png

 

I edit the first cell adding a lot more blank space at the beggining and then click on Show Text

blob.png.f95bd21eae7139b1cd9f0994a7845127.png

The text has been trimed.

 

I attach a test project. 

 

It would be great if someone can help me.

 

Regards

 

UniStringGrid.zip

Link to comment
Share on other sites

You can open the request in the support portal...:

procedure TUniStringGrid.SetCellValue(ACol, ARow:Integer; OldValue, NewValue: Variant; AuxParam: string);
var
  Attr, S : string;
begin
  if (ACol < FColumnCount) and  (ARow < FRowCount) then
    try
      FInternalSet := True;
      S := Trim(NewValue); <------------
  ...

 

Link to comment
Share on other sites

As a workaround, you can try this approach:

procedure TMainForm.UniStringGrid1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
var
  colIdx, rowIdx: Integer;
begin
  if EventName = '_edit' then
  begin
    colIdx := StrToInt(Params.Values['colIdx']);
    rowIdx := StrToInt(Params.Values['rowIdx']);

    (Sender as TUniStringGrid).Cells[colIdx, rowIdx] := Params.Values['val']
  end;

end;
function edit(editor, context, eOpts)
{
    var ctx=context;
    ajaxRequest(ctx.grid, '_edit', ['colIdx='+ctx.colIdx, 'rowIdx='+ctx.rowIdx, 'val='+ctx.value]);
    
    return false; 
}

 

Link to comment
Share on other sites

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...