CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Editable grid multiple rows update at once

Print topic Send  topic

Author Message
Dorin

Posts: 50
Posted: 11/07/2011, 6:32 AM

Hello,

I have an editable grid with the following columns: ''Id'', ''Task'', ''Date'', ''Assigned to'' and a search that filters the grid's records.

I need to update the column ''Assigned to" of all the records find by the search at once with a value from a listbox (placed somewhere in the grid).

Any ideas?

Thx.

View profile  Send private message
TheunisP

Posts: 342
Posted: 11/07/2011, 6:54 AM

I'm not sure what you mean with 'at once' and does each row have its own list box for 'Assigned to'?

View profile  Send private message
Dorin

Posts: 50
Posted: 11/07/2011, 11:08 PM

I want to use a single list box (place in the buttons'area for example) for updating the "Assigned to" fields.

Although, each row have it's own list box for "Assigned to" field.

My problem is that I have to update tens of records one by one for the same value of "Assigned to".

I imagine this having a check box in each row, a link for selecting all the check boxes and a button which will parse all the selected rows performing the updates with the selected value of that list box.

But this is in theory :-). I didn't find any example of doing this.
View profile  Send private message
TheunisP

Posts: 342
Posted: 11/08/2011, 12:58 AM

we use a a javascript one liner in a controls onclick or onchange event to manipulate editable grid values on mass:

for (i=0;i<GridName.elements.length;i++) if (GridName.elements.name.indexOf('ControlName')!=-1) GridName.elements.checked=true;

the exmample above will for for instance check all checkboxes in a grid with a specific name (remember to change the GridName & ControlName to the correct values)

so for you you will most prob need somethinng like this

for (i=0;i<GridName.elements.length;i++) if (GridName.elements.name.indexOf('InsideControl')!=-1) GridName.elements.value=this.value;

the above code code codes into the onchange event of the outside list box - when you you change the value the code will look for controls inside the grid with the name InsideControl and if found set their value to this controls value.





View profile  Send private message
Dorin

Posts: 50
Posted: 11/08/2011, 1:03 AM

Thx. Theunis. I'll give it a try.
View profile  Send private message
TheunisP

Posts: 342
Posted: 11/08/2011, 1:24 AM

no prob ;-)
View profile  Send private message
tumby1974

Posts: 26
Posted: 03/09/2012, 9:00 AM

Quote TheunisP:
we use a a javascript one liner in a controls onclick or onchange event to manipulate editable grid values on mass:

for (i=0;i<GridName.elements.length;i++) if (GridName.elements.name.indexOf('ControlName')!=-1) GridName.elements.checked=true;

the exmample above will for for instance check all checkboxes in a grid with a specific name (remember to change the GridName & ControlName to the correct values)


I'm trying this example for updating all of the checkboxes in an editable grid, but it doesn't seem to be working.

I stuck a checkbox (from forms tab) in the column header of the column of checkboxes I want to select. I put text next to this checkbox "select all"

on this checkbox's on click event (for client side; javascript) I put your code in, and changed the gridname to the proper grid and the control name to the checkbox control I want to change.

But nothing is happening.
:-<
View profile  Send private message
tumby1974

Posts: 26
Posted: 03/09/2012, 9:43 AM

Quote :
Hello,
I’m using this code to select all Delete checkbox with one click. I assigned it to onClick event of a Link:


function select_all() {
init<form_name>Elements();
for(var j = 0; j < <form_name>Elements.length-<form_name>EmptyRows; j++){
<form_name>Elements[j][bugsDeleteControl].checked = true;
}

replace "<form_name>" keyword with a real form name.

Found this digging back into the forum. Still not working. Would it be something like:

  
function select_all() {    
 initGridNameElements();    
 for(var j = 0; j < GridNameElements.length-GridNameEmptyRows; j++){    
 GridNameElements[j][ControlName].checked = true;    
}    
View profile  Send private message
tumby1974

Posts: 26
Posted: 04/19/2012, 2:19 PM

Figured it out with help from this page: http://stackoverflow.com/questions/9493089/javacript-an...all-check-boxes


javascript:
  
function toggle(source) {  
    var inputs = document.getElementsByTagName('input');  
    var i, input;  
  
    for(i = 0; input = inputs; i++) {  
        if((' ' + input.className + ' ').indexOf(' checkall ') > -1) {  
            input.checked = source.checked;  
        }  
    }  
}  




checkbox you want to use as your select/deselect toggle:
  
<input id="test1CheckBox1" value="1" onclick="javascript:toggle(this);" type="checkbox" name="{CheckBox1_Name}" {CheckBox1}>   
onclick="javascript:toggle(this);" is added



checkbox (in the editable grid) that will be selecting/deselecting:
  
<input class="checkall" id="test1test_obtained_permit_{test1:rowNumber}" value="1" type="checkbox" name="{test_obtained_permit_Name}" {test_obtained_permit}>  
class="checkall" is added

View profile  Send private message
Dorin

Posts: 50
Posted: 07/25/2013, 9:30 PM

Back to this problem. I tried Theunis's code using the onchange event of a listbox:

for (i=0;i<TestGrid.elements.length;i++) if (TestGrid.elements.name.indexOf('Status')!=-1) TestGrid.elements.value=this.value;

but nothing happens when I select a listbox value.

I believe this is a common situation and I'm not the only one who try this mode to update multiple values at once.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.