Page 1 of 2
Colorise Brouse form
Posted: Fri Aug 10, 2012 1:59 pm
by forgot
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
Re: Colorise Brouse form
Posted: Fri Aug 10, 2012 9:40 pm
by admin
Maxim,
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);
And Change
SQL (on the General Tab) to..
You can try it on the
Financial Module, Customer Browse.
nufin.png
Hopefully it answers both your questions..
Steven
Re: Colorise Brouse form
Posted: Sun Aug 12, 2012 11:20 am
by forgot
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.
Re: Colorise Brouse form
Posted: Sun Aug 12, 2012 1:20 pm
by forgot
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.
Code: Select all
//--running JavaScript on a Browse Form
$j = "";
addJSfunction($j);
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
Re: Colorise Brouse form
Posted: Mon Aug 13, 2012 5:02 am
by admin
Maxim,
Here's the fix I will also put it in the next version..
Steven
Re: Colorise Brouse form
Posted: Mon Aug 13, 2012 10:15 am
by forgot
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.
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);
Slightly change this code and you can colorize your browse form.
Re: Colorise Brouse form
Posted: Mon Aug 13, 2012 10:18 am
by forgot
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.
Re: Colorise Brouse form
Posted: Tue Aug 14, 2012 11:02 pm
by admin
Maxim,
I don't understand your last post.
Steven
Re: Colorise Brouse form
Posted: Wed Aug 15, 2012 1:03 am
by zazzium
forgot,
u can use instead nuLoadThis() jquery load in before browse
Code: Select all
$(document).ready(function () {
//code
});
or vice versa
Re: Colorise Brouse form
Posted: Wed Aug 15, 2012 8:40 am
by forgot
zazzium
Excellent!!!! Thank you very much!
