Giter Club home page Giter Club logo

Comments (6)

sourcebits-robertbiggs avatar sourcebits-robertbiggs commented on July 30, 2024

Andres,

Thanks for using ChUI. $.UIEditList works just like $.UIDeletable with callbacks. Just pass in a function as the callback with a default parameter for the item that the user will delete. That parameter will refer to the item. This will be the bare node element. If you want to use jQuery functions on it, you'll need to wrap it in $() first. Please look at the example: editable-list.html

Also, you can find more details about how to pass options to $.UIEditList at: http://chocolatechip-ui.com/documentation#/chuijs Tap on the $.UIEditList in the menu on the left.

from chocolatechip-ui.

andresviviani1 avatar andresviviani1 commented on July 30, 2024

Thanks for your response! I tried a lot of times in different ways I and I missed. I modified the example to show a simple alert and it only works after I click on the done button (as they say in the documentation). I would like to know how can I trigger a callback immediately after I delete an item (not when I click on the done button) such as the previous version(3.6.3). I did this:

var editableListOptions = {
movable: false,
callback: function(item) {
alert("hello world");
}
};
$('#editList').UIEditList(editableListOptions);

And it only shows the alert when I click on the done button (and not when I delete an item)...

Thanks again for your help...

from chocolatechip-ui.

sourcebits-robertbiggs avatar sourcebits-robertbiggs commented on July 30, 2024

In that case, you could do something like this:

$('#editList').on('singletap', 'button.delete', function(e) {
  alert($(this).closest('li').find('h3').text());
});

I assume you want to get something, such as an item ID. But this is the same principle.

Please note that this is not a callback. After initializing the Editable list, add this delegated event listener to execute when the delete buttons are tapped.

from chocolatechip-ui.

andresviviani1 avatar andresviviani1 commented on July 30, 2024

Thank you so much... I think the previous behavior was better and this solution is a bit weird... But it works very well!!! Thanks again!!!

from chocolatechip-ui.

sourcebits-robertbiggs avatar sourcebits-robertbiggs commented on July 30, 2024

well, technically this gives you the ability to provide the user a way of canceling a deletion or move. And because the widget allows deletion and moving, you handle the final state with the done button, that's how native OS handle this type of list.

from chocolatechip-ui.

andresviviani1 avatar andresviviani1 commented on July 30, 2024

Cool! That's true... You are right... For the other hand, I don't know if you help with official documentation (I watched your videos) but it has a few things out of date and also a few spelling errors... I think this is a powerful and helpful framework and it could be better if the documentation was updated as possible. I can let you know some parts where it would be great to fix, to help learning people like me.

from chocolatechip-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.