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

data-if-XXX == "null" doesn't work #84

Open
ErnestoLopez opened this issue Jun 26, 2013 · 11 comments
Open

data-if-XXX == "null" doesn't work #84

ErnestoLopez opened this issue Jun 26, 2013 · 11 comments

Comments

@ErnestoLopez
Copy link

I can't draw template only if XXX field is null or is not null.

I've tried with next code:

<.... data-if-XXX = "null">
<.... data-if-XXX = 'null'>
<.... data-if-XXX = null>
<.... data-if-XXX = "'null'">
<.... data-if-XXX = "">
....

and negative options
<.... data-if-XXX != "null">
....

but nothing.

I really appreciate any help you can provide.

@mrolafsson
Copy link
Contributor

You can try data-has:

<li data-template data-has="friend">{{friend}}></li>

@ErnestoLopez
Copy link
Author

Field exists, but have null value.
I want avoid to draw rows that a particular field is null

thanks a lot.

@mrolafsson
Copy link
Contributor

I see - in the latest version of Tempo on the master branch you can now check for null with data-if-:

<li data-template data-if-type="null">I am a nothing: {{name}}</li>

Let me know if that works for you - thanks for reporting!

@ErnestoLopez
Copy link
Author

latest versión of Tempo on the Master Branch

¿2.1?

doesn't Works for me with same call I did with Tempo 2.0

if I change 358 line adding

                } else if (attr.value === 'null') {
                    val = null;

in 2.0 versión works fine

   null equal comparations 

but doesn't work

   null not equal comparations

I will be watching next versions until it woks.

Meanwhile I'm doing this conditions in SQLite querys.

Regards,

Ernesto.

@mrolafsson
Copy link
Contributor

I'm not sure what you're suggesting here. Ideally you do this in the model/data layer.

@ErnestoLopez
Copy link
Author

Originally I wanted filter JSon data, hidding those rows that had a null field using Tempo.

But I can't, thus I will rewrite the way I obtain JSon data through sql query.

Thanks a lot for this great job, I will use Tempo and will be alert for every changes.

Ernesto.

@mrolafsson
Copy link
Contributor

Strange this should work just fine now. Can you paste in some example JSON?

@ErnestoLopez
Copy link
Author

Here is the code:

http://jsfiddle.net/BmkC8/

it works fine but

  • When I update my own code (phonegap + jquery + jquerymobile +....) with tempo.js to 2.1 tempo doesn´t work.
  • In the other hand, how can I configure tempo to show rows where a particular field <> null

Regards.

@mrolafsson
Copy link
Contributor

The jsfiddle does not have a reference to Tempo so doesn't work - I will have a look at that. I can't tell you why your application doesn't work without seeing any debug information.

@mrolafsson
Copy link
Contributor

This seems to work fine? http://jsfiddle.net/BmkC8/3/

@mrolafsson
Copy link
Contributor

To check for not null you would either have to use some other method of checking or we would have to add data-if-not support.

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

No branches or pull requests

2 participants