CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 SmartLookup w/Editable Grid

Print topic Send  topic

Author Message
maggiemel

Posts: 75
Posted: 11/04/2005, 8:43 AM

Has anyone successfully implemented the Pop-Up / Smart Lookup feature (as demonstrated in the CCS Example Pack) using an editable grid rather than a record form?

I'm wondering if it's possible to have a pop-up window open, give users some choices, have them click on one and then return that result into a line on an editable grid. Seems complicated -- but is it impossible?
_________________
Melissa Cahill
http://www.hellcatmaggie.net/
View profile  Send private message
DonB
Posted: 11/04/2005, 3:30 PM

Not be much different than how the example is done, although I'd utilize an
'id' attribute to identify the specific field to update. I think the
example pack assumes a specific name for the field and hard codes that.
Each field can pass the 'this' object (or simply 'this.id' to pass just the
id value) as a parameter to the lookup function and thus inform the function
(and the popup form) which field is to receive the result.

The mechanics are all the same, just needs to be a little smarter than the
standard example.

--
DonB

http://www.gotodon.com/ccbth


"maggiemel" <maggiemel@forum.codecharge> wrote in message
news:2436b8fae805dd@news.codecharge.com...
> Has anyone successfully implemented the Pop-Up / Smart Lookup feature (as
> demonstrated in the CCS Example Pack) using an editable grid rather than a
> record form?
>
> I'm wondering if it's possible to have a pop-up window open, give users
some
> choices, have them click on one and then return that result into a line on
an
> editable grid. Seems complicated -- but is it impossible?
> _________________
> Melissa Cahill
> http://www.hellcatmaggie.net/
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

marcwolf


Posts: 361
Posted: 11/10/2005, 3:27 PM

Hi DonB and MaggieMel

Thats is the way that we have done it.

Each grid row has a unique ID so we can do this

1. Get ID of the control that was clicked.

2. Extract the ROW ID from it ( AField_1, BField_1 = _1 is your ROW)

3. Process your popup as usual but passing the ROW ID in to you can work with it later

4. When Pop-Up has finished and passing info back you can do this
Field_To_Update = Field_Name + "_" + ROW_ID

So is your roa is 5 and the field name is PRICE you can get
PRICE_5

Now all you have to do is update any other field on that row with the changed value

We went quite a bit further here.. Sorry - the code is very extentsive and integrated into the whole page so I cannot separate easily.. but we had a Invoicing system.

Master record at the top in a separate from with the grid below being for the items. Each time an item was added or updated JS would loop through the editable grid and total the prices, quantieies etc.

Each product item has a range of colors and textures, and we used a popup to allow the customer to change these, which in turned changed the sales and wholesale price of the item.

Here are some code snippets for you to look at


Hers is how we got the ROWID

// Get Editable Grid Row from Control  
// Pass Control as object (THIS), returns back string of "_x" where x is row  
function GetRowID(Field1){  
       var fldname = ""; var fldname1 = ""; var fldloc = -1;    
       fldname = Field1.name;     fldloc = fldname.lastIndexOf("_"); // work out the calling field and extract its index  
       if (fldloc <= 0) {return "";}  // Not an Index.. Return a Blank, safe to append to control name  
       else  
       {return fldname.substring(fldloc,fldname.length);} // returns back the '_x' where x is the row  
}



And here is how we ran a recalc routine to sum the PRICE/QTY for each indiviual row

ORDER_ITEM is the grid with 12 rows in it. CalcPrice is our calculation routine and VERY complex so not included here.

function ReCalc() {  
  var result = true;  
  var amt1 =0;  
  var amt =0;  
  var tmp;  
   for (var j = 1; j <12; j++) {  
              // check for existance of the element  
              if (eval("document.forms[\"order_item\"].price_total_" + j)) {  
                     tmp = "CalcPrice(document.forms[\"order_item\"].price_total_" + j + ")";  
                     eval(tmp);  
                       
              }  
       }  
}  
  


Hope this Javascript helps in giving you some idea's..

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
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.