gwtgwt-celltable

gwt:adding clickhandler to ImageResource cell


I want to add an image to my celltable , for that i use imageResouce as below

         interface Resources extends ClientBundle {
         @Source("close.png")
         ImageResource getImageResource();
          }

         Resources resources = GWT.create(Resources.class);

         deleteJobColumn = new Column<EmployerJobs, ImageResource>(new ImageResourceCell()) {
        @Override
        public ImageResource getValue(EmployerJobs object) {
              return resources.getImageResource();
        }
    };

Its working perfectly fine , i am getting image in my celltable but Now i want to add clickhandler to that image ,For that i am using field Updater like below

         display.getListJobsWidget().getDeleteJobColumn().setFieldUpdater(

            new FieldUpdater<EmployerJobs, ImageResource>() {

                public void update(int index, EmployerJobs employerJobs,
                        ImageResource value) {

                                       Window.alert("Hello");

                }
            });

so now when i click on that above image cell it should say "Hello", but its not doing any thing .. Any solution ..

Thanks


Solution

  • ImageResourceCell doesn't have any wiring to call the ValueUpdater, it is just designed to draw the image and be done with it.

    You have a few ways you can change this: