How i can set checkedvalue or uncheckedvalue for checkbox component inside pl/sql?

asked 02 Nov '12, 03:09

lezgin's gravatar image

lezgin
71315
accept rate: 0%


Hi Lezgin,

As i understand you have a grid based on a view. Inside the grid is a checkbox. If you check the checkbox the row must be deleted, and if you uncheck, the row must be saved.

I would do the following: Create the view including the checkbox column (wich would be null for all rows) Define the datasource on the view, and specify the primary key, so you can check insert, update and/or delete. Create the grid with the checkbox and define the checkbox values like:

<checkBox name="your_checkbox_name" column="name_of_view_column" checkedValue="Y" uncheckedValue="N"/>

Create an instead of trigger on the view. In this instead of trigger, catch the condition of the checkbox and save, or remove according to the checkbox value set. Something like this:

create or replace trigger your_trigger_name
   instead of update or delete or insert on your_view_name
begin
   if updating
   then
      if :new.checkbox_value = 'Y'
      then
         update your_table
         set    id          = :new.id
               ,column_name = :new.column_name
         where  id = :old.id;
      else
         delete from your_table
         where  id = :old.id;
      end if;
   elsif deleting
   then
      delete from your_table
      where  id = :old.id;
   else
      /* inserting */
      -- depends on your use case if you can insert a new row
      -- might have to chack for the checkbox value as well..   
      if :new.checkbox_value = 'Y'
      then
         insert into your_table
            (id
            ,column_name)
         values
            (:new.id
            ,:new.column_name);
      end if;
   end if;
end;

After saving the grid with api_datsource.docommit ('your_datasource') requery the grid with api_datasource.executeQuery('your_datasource')

Should work i think..

Best , Michiel A

link

answered 02 Nov '12, 08:57

Michiel%20A's gravatar image

Michiel A
5161541
accept rate: 13%

edited 02 Nov '12, 09:01

Hi Michiel . Ugur helped me to fix this problem. Your solution is like Ugur solution

(02 Nov '12, 12:41) lezgin

Hi Zamir,

There isn't an API setting the checkedValue/unchekedValue of the checkBox. If you need such an API, we can add it among the candidate features to be included to the future releases.

Regards, Ibrahim

link

answered 02 Nov '12, 03:28

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

I wanna save data if checkbox was checked and remove daa from table if checkbox unchecked. How i can do it?

(02 Nov '12, 03:34) lezgin

checkbox must be inside GRID.

(02 Nov '12, 03:34) lezgin

Hi Zamir,

If the checkBox is inside of a grid, a datasource column should be already bound to this checkBox. Therefore, you can retrieve its value through the api_datasource.getColumnValue API.

Regards, Ibrahim

(02 Nov '12, 04:00) Ibrahim Sand... ♦♦

i replaced query with view. but still i can't set data to table. ((

(02 Nov '12, 04:29) lezgin
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×10

Asked: 02 Nov '12, 03:09

Seen: 1,126 times

Last updated: 02 Nov '12, 12:41


© Copyright Gerger 2017