Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problema com a classe XTemplate #60

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 2 comments
Open

problema com a classe XTemplate #60

GoogleCodeExporter opened this issue Mar 14, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Eu encontrei um problema ao tentar utilizar a classe XTemplate de um 
TExtFormComboBox.

a biblioteca aplica os seguintes filtro na string objetivando obter suas partes.

        re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,
        nameRe = /^<tpl\b[^>]*?for="(.*?)"/,
        ifRe = /^<tpl\b[^>]*?if="(.*?)"/,
        execRe = /^<tpl\b[^>]*?exec="(.*?)"/,

e o extpascal gera o seguinte código:
tpl: "<tpl for='.'><div class='x-combo-list-item'>{persLastName}, 
{persFirstName}</div></tpl>",

então quando se aplica o filtro for="(.*?)" não se encontra nada, pois a 
string está escrita com for='.', ou seja, precisa trocar o ' por ".



# What steps will reproduce the problem?

1.
2.
3.

# What is the expected output? What do you see instead?

# What version of the product are you using? On what operating system?

- extPascal: rev.XXX
- extJS: v.X.X.X
- compiler: FPC X.X.X
- OSes: XXXXX, XXXXX, XXXXX

# Please provide any additional information below.

- related discussion thread:
http://groups.google.com/group/extpascal/browse_thread/thread/xxxxxxxxxxx

- related FPC issue:
http://bugs.freepascal.org/view.php?id=xxxx

Original issue reported on code.google.com by jonatas....@gmail.com on 18 Jun 2010 at 5:45

@GoogleCodeExporter
Copy link
Author

This issue is an actual ExtPascal limitation: double quotes are replaced by 
single quotes. ***Issue 54***

Original comment by wanderla...@gmail.com on 18 Jun 2010 at 5:50

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

I solved this using this code:

procedure TExtFormComboBox.SetFTpl(Value : String); begin
  FTpl := Value;
  if (Value[1]='"') then
    JSCode('tpl:' + Value)
  else
    JSCode('tpl:' + VarToJSON([Value]));
end;

Tpl := '"<tpl for=\".\"><div 
class=\"x-combo-list-item\">Nome:{name}</div></tpl>"';

I know that this is not the perfect solution but it's works;

Original comment by jonatas....@gmail.com on 18 Jun 2010 at 8:37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant