Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Colorise Brouse form
-
- Posts: 42
- Joined: Thu Aug 09, 2012 8:52 pm
Colorise Brouse form
Hello
Wonderful system. So easy and so powerful! Very easy jump up from Access without knowledge in mySQL and PHP.
Is it possible change style (color of text or background) for specific row in Browse form?
Is there equivalent javafunction nuLoadThis() for Browse form like in Screen form? Function that execute at start of Browse form and I can change it.
Thanks,
Maxim
Wonderful system. So easy and so powerful! Very easy jump up from Access without knowledge in mySQL and PHP.
Is it possible change style (color of text or background) for specific row in Browse form?
Is there equivalent javafunction nuLoadThis() for Browse form like in Screen form? Function that execute at start of Browse form and I can change it.
Thanks,
Maxim
-
- Site Admin
- Posts: 2782
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 2 times
Re: Colorise Brouse form
Maxim,
If you put this in Before Browse
And Change SQL (on the General Tab) to..
You can try it on the Financial Module, Customer Browse.
Hopefully it answers both your questions..
Steven
If you put this in Before Browse
Code: Select all
//--changing style in a Browse Form
$s = <<<EOSQL
CREATE TABLE #browseTable# SELECT
customer_id,
cus_code,
cus_phone,
cus_mobile,
cus_fax,
IF(LEFT(cus_name,1)="J", CONCAT('<b>',cus_name,'</b>'),cus_name) AS cus_name
FROM customer
EOSQL;
nuRunQuery($s);
//--running JavaScript on a Browse Form
$j = <<<EOJS
function nuLoadThis(){
alert('Customer Names Starting with "J" have been highlighted');
}
EOJS;
addJSfunction($j);
Code: Select all
SELECT * FROM #browseTable#
Hopefully it answers both your questions..
Steven
-
- Posts: 42
- Joined: Thu Aug 09, 2012 8:52 pm
Re: Colorise Brouse form
After that manipulations on Customer browse form customer that start with "J" now bold.
But something strange happened. When this Customer form with modify "Browse before" use as lookup form all goes wrong. Customer "J" still bold but when you click on it nothing happened. I say about lookup form.
You can see when creating new invoice on the Financial Module.
As I find it happened after you override function nuLoadThis().
--
Maxim
Sorry for my poor English. Hope you understand all clearly.
But something strange happened. When this Customer form with modify "Browse before" use as lookup form all goes wrong. Customer "J" still bold but when you click on it nothing happened. I say about lookup form.
You can see when creating new invoice on the Financial Module.
As I find it happened after you override function nuLoadThis().
--
Maxim
Sorry for my poor English. Hope you understand all clearly.
-
- Posts: 42
- Joined: Thu Aug 09, 2012 8:52 pm
Re: Colorise Brouse form
So I found that this some problem with addJSfunction($j); function. If I use it javafunction doIt(pID) despaired from source of form.
As I understand doIt dynamically add when form use as Lookup form.
If use this simple code in Before Browse then select for lookup doesn't work.
If you comment //addJSfunction($j); all will work!
For my task very critical add JavaScript to startup of browse form that use for LOOKUP field.
--
Maxim
As I understand doIt dynamically add when form use as Lookup form.
If use this simple code in Before Browse then select for lookup doesn't work.
Code: Select all
//--running JavaScript on a Browse Form
$j = "";
addJSfunction($j);
For my task very critical add JavaScript to startup of browse form that use for LOOKUP field.
--
Maxim
-
- Site Admin
- Posts: 2782
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 2 times
Re: Colorise Brouse form
Maxim,
Here's the fix I will also put it in the next version..
Steven
Here's the fix I will also put it in the next version..
Steven
- Attachments
-
- formlookup.zip
- (2.12 KiB) Downloaded 357 times
-
- Posts: 42
- Joined: Thu Aug 09, 2012 8:52 pm
Re: Colorise Brouse form
Thank you Steven. Works!
Here my approach for modify browse form using Javascripts.
So task was for invoice in my system show in lookup form for choosing item only active item. In separate form (item property) sales manager can choice for specific customer that item active and that inactive. And this state will change couple of time and invoice_items and products relationship together because of it impossible using only SQL with where statement.
Slightly change this code and you can colorize your browse form.
Here my approach for modify browse form using Javascripts.
So task was for invoice in my system show in lookup form for choosing item only active item. In separate form (item property) sales manager can choice for specific customer that item active and that inactive. And this state will change couple of time and invoice_items and products relationship together because of it impossible using only SQL with where statement.
Code: Select all
//--running JavaScript on a Browse Form
$j = <<<EOJS
function hideSell(sell){
document.getElementById(sell).innerHTML = "";
document.getElementById(sell).onmouseover = "";
document.getElementById(sell).onmouseout = "";
document.getElementById(sell).onclick = "";
document.getElementById(sell).style.cursor = "default";
}
function rowsHide(){//---hide rows that unactive
var columeNumber = 6; //---number with code colum
var unactiveCode = 20; //---unactive code
//---hide colum title
element = document.getElementById("title"+columeNumber);
element.parentNode.removeChild(element);
//---for each row in browse form
for(i = 0 ; i < 5 ; i++){
if ( i < 10 ) {
rw = "rw0" + i;
} else {
rw = "rw" + i;
}
//---get volume from code colume and hide this colum
vol = document.getElementById(rw+columeNumber).innerHTML;
vol = vol.substring(9,11);
hideSell(rw+columeNumber);
//---if this unactive element hide whole row
if (vol == unactiveCode) {
//---for each colom for specific row
for(j = 0 ; j < 7 ; j++){
hideSell(rw+j);
};
}
};
}
function nuLoadThis(){
rowsHide();
}
EOJS;
addJSfunction($j);
-
- Posts: 42
- Joined: Thu Aug 09, 2012 8:52 pm
Re: Colorise Brouse form
One more issue with JavaScript at startup lookup.
Then you have two function nuLoadThis(). One in JavaScript of Main Screen form and other in Before Browse of lookup form.
Only JavaScript in Before Browse of lookup form will execute.
Then you have two function nuLoadThis(). One in JavaScript of Main Screen form and other in Before Browse of lookup form.
Only JavaScript in Before Browse of lookup form will execute.
-
- Posts: 84
- Joined: Mon Jul 04, 2011 12:52 am
Re: Colorise Brouse form
forgot,
u can use instead nuLoadThis() jquery load in before browse
or vice versa
u can use instead nuLoadThis() jquery load in before browse
Code: Select all
$(document).ready(function () {
//code
});
-
- Posts: 42
- Joined: Thu Aug 09, 2012 8:52 pm