Git Product home page Git Product logo

datagrid's People

Contributors

ais-one avatar fcordeiro6 avatar lazymofo avatar raffaelj avatar vegax87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datagrid's Issues

Checkbox behaviour unusual

The demo shows column 'is_active' as tinyint(1) with default NULL. I would have expected to see '0', zero.
The update or add work by applying NULL.
I would like to ensure '0' is recorded, have you a tip here please.
If the column tinyint(1) requires not null, it will not update or add new, because the script tries to apply null for '0', even if a default value '0' is provided in the db table config.

Mike B

License

Hello :)

I just found this pearl and I wanted to know what license this is released under :)

Upload images turns up black

Hi, I'm finding your datagrid very useful. Got few tiny problems, main one is that uploaded images works but sometimes they end up as black images. Both the thumbnail and the main images, both just a black image. It doesnt happen for all images, but it happens on mobile and pc for me.

fyi, these are the parameter values I'm using for the upload:

$lm->image_quality=100;
$lm->upload_allow_list ='.jpg .jpeg .png';	
$lm->upload_width = 300;
$lm->upload_height = 300;
$lm->upload_crop=true;

sometimes the image also gets flipped 90% degrees to the left.

public suite of custom functions

The new format of functions allows for the creation of a lot of generic functions with customizable user options.

I have some I would like to share, some similar to the JQuery UI Datepicker in the help documentation but for select2 and fastselect with some nice options like ordering, onclick/onload .... (created to improve the performance issue that some browsers have when loading multiple dropdowns with many options)

I am also in the process of making some functions that would turn lm into an ajax datagrid, possibly with some sort of concurrent multiuser support ....

It may be nice to have a place for such functions to be shared.
Possibly a separate include for such jquery/javascript functions, or perhaps an extended class,
or these could be added to the main class if felt useful for all.

I would like you to look at them first. see what you think.
How can I send them to you?

Edits not committed

I'm getting no errors, and it acts like it's updating, but the changes are not saving. Want to change the Y to a N (the the data isn't used in reports). Other tables are acting correctly for edits, but this one has a custom add page, didn't know if that is related to this annomally. Since there are differences, I made the
change:
public $grid_add_link = "<a href='addticket1.php' class='lm_grid_add_link'>Add a Record</a>";
and saved as lazy_mofo26_tkt.php and all other pages use the unchanged lazy_mofo.php

`<?php

require('dist/lazy_mofo26_tkt.php');
// create LM object, pass in PDO connection
$lm = new lazy_mofo($elcon);

// table name for updates, inserts and deletes
$lm->table = 'tbltkts';

// identity / primary key for table
$lm->identity_name = 'tktid';

// optional, make friendly names for fields
$lm->rename['linkid'] = 'Shipper';
$lm->rename['itemnumb'] = 'Item';
$lm->rename['ticknumb'] = 'TKT #';
$lm->rename['tickdate'] = 'TKT Date';
$lm->rename['grosswt'] = 'Gross WT';
$lm->rename['tarewt'] = 'Tare WT';
$lm->rename['netwt'] = 'Net WT';
$lm->rename['persmoist'] = '% Moisture';
$lm->rename['lname'] = 'Business/Last Name';
$lm->rename['fname'] = 'First Name';

//addtional html inside form after form buttons
//$form_additional_html = 'test';

// optional, define input controls on the form
$lm->form_input_control['entby'] = '--whoent';

function whoent($column_name, $value, $command, $called_from){
// $column_name: field name
// $value: field value
// $command: full command as defined in the arrays: form_input_control, grid_input_control, or grid_output_control
// $called_from: which function called this user function; form, or grid
global $lm;
$val = $lm->clean_out($_SESSION['user']['username']);
return "";
}
//$lm->form_input_control['inuse'] = "select Y, 'Yes' union select N, 'No' union select H, 'Maybe'; --radio";
$lm->form_input_control['invID'] = 'select itemnumb, itemdesc, stdUnit from tblinventory order by itemdesc asc; --select';
$lm->form_input_control['tktid'] = 'select tktid, lname, fname from tblacts; --select';
$lm->form_input_control['inUse'] ='Y';

// change back button to read "Cancel"
$lm->form_back_button = "";
$lm->form_delete_button = "";

// alter link text
$lm->grid_add_link = str_replace('Add a Record', 'Add New', $lm->grid_add_link);
$lm->grid_edit_link = str_replace('[edit]', 'Edit', $lm->grid_edit_link);

// hide delete and export links
$lm->grid_delete_link = "";
$lm->grid_export_link = "";

// change success message
$lm->form_text_record_added = "New Record Added";
$lm->grid_text_record_added = "New Record Added";

// optional, define editable input controls on the grid
//$lm->grid_input_control['inUse'] = '--checkbox';

// optional, define output control on the grid
/*$lm->grid_output_control['contact_email'] = '--email'; // make email clickable
$lm->grid_output_control['photo'] = '--image'; // image clickable */

// new in version >= 2015-02-27 all searches have to be done manually
$lm->grid_show_search_box = true;

// optional, query for grid(). LAST COLUMN MUST BE THE IDENTITY for [edit] and [delete] links to appear
$lm->grid_sql = "
select
t.tktid
, t.ticknumb
, t.tickdate
, a.lname
, a.fname
, i.itemDesc
, t.grosswt
, t.tarewt
, t.netwt
, t.percmoist
, t.inUse
, t.tktid
from tbltkts t
left
join tblacts a
on t.linkid = a.autoid
join tblinventory i
on t.invID = i.itemnumb
where t.inUse ='Y'
and (coalesce(a.lname, '') like :_search
or coalesce(i.itemDesc, '') like :_search
or coalesce(t.ticknumb, '') like :_search )
order by t.tickdate desc
";
$lm->grid_sql_param[':_search'] = '%' . trim(@$_REQUEST['_search']) . '%';

// optional, define what is displayed on edit form. identity id must be passed in also.
$lm->form_sql = "
select
tktid
, ticknumb
, tickdate
, invID
, linkid
, grosswt
, tarewt
, netwt
, percmoist
, entered
, entby
, inUse
from tbltkts
where tktid = :tktid
";
$lm->form_sql_param[":$lm->identity_name"] = @$_REQUEST[$lm->identity_name];

// optional, validation. input: regular expression (with slashes), error message, tip/placeholder
// first element can also be a user function or 'email'
$lm->on_insert_validate['ticknumb'] = array('/.+/', 'Missing Ticket Number', ' Required');
$lm-&gt;on_insert_validate['tickdate'] = array('/^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$/', 'Invalid date', 'Required', true);
$lm->on_insert_validate['grosswt'] = array('/[0-9]/', 'Missing weight', 'Required', true);
$lm->on_insert_validate['invID'] = array('/[0-9]/', 'Missing Item', 'Required', true);
$lm->on_insert_validate['linkid'] = array('/[0-9]/', 'Missing shipper', 'Required', true);
$lm->on_insert_validate['tarewt'] = array('/[0-9]/', 'Missing weight', 'Required', true);
$lm->on_insert_validate['percmoist'] = array('/[0-9]/', 'Missing moisture percent', 'Required', true);
$lm->on_insert_validate['inUse'] = array('/[YN]/', 'Required', true);

// copy validation rules to update - same rules
$lm->on_update_validate = $lm->on_insert_validate;

$lm->return_to_edit_after_insert = false;
$lm->return_to_edit_after_update = false;

// use the lm controller
$lm->run();
?>`

What should I check first? Thanks.

group_concat limit override option suggestion

sometimes large group_concats (useful for getting subquery data into a cell) fail due to mysql limits. This can be overridden, but would be nice to have an option in the class.

Just like you have
public $charset_mysql = 'utf8mb4';

and then in the query function, you have:

        if(!$this->set_names){
            $sth = $this->dbh->prepare("set names $this->charset_mysql");
            $sth->execute();
            $this->set_names = true;
        }

You COULD also add a similar parameter:
public $group_concat_max_len = '1000000';
or
public $group_concat_max_len = ''; // leave blank for default, or 1000000 for large group_concats

and add this to the query function

        if(!$this->set_group_concat_max_len && !empty($this->group_concat_max_len)){
            $sth = $this->dbh->prepare("SET @@group_concat_max_len = $this->group_concat_max_len");
            $sth->execute();
            $this->set_group_concat_max_len = true;
        }

full command in custom function

Just curious, did this update break your code?

I feel like any fix results in a worse outcome.

For a little background, this parameter is not used too often. It holds the control name, which used to look like this "--my_control". In the new version the string comes through as "my_control".

If I "fix" this depending on how the control is setup (old --prefixed, versus new array), then output will vary on setup, which I don't like.

I'd rather the output be consistent and possibly break a little backward compatibility in this case.

Originally posted by @lazymofo in #45 (comment)

Not Responsive!

Dear Developer,

I have used and recommended most of my friends to use LazyMofo for simple CRUD applications.

One small issue which always bother me is , the screens are not responsive! Its very difficult to view in Small hand held devices. I wish it had some sort of Bootstrap integration to it.

Is there any plans?

Many thanks.
Srinath Rao

Blank multiselect2 works with grid but not with form

First of all, this is not an issue with the native html MULTISELECT that is default in lazymofo.
If I use a custom function that calls select2 (js) I have some issues with blank fields as follows:
if there is NO DATA in the field when a form/grid is loaded, and the field is left blank - there is no issue.
If there IS DATA in the field when a form/grid is loaded if I then blank the field I get the following:
no data for that field is passed in the post data, not even a fieldname = [""], which causes the following:
if I am on a FORM, the lack of post data causes the field not to be updated and so the form is repopulated with success but the field has the data it had prior to clearing.
If I ma on a GRID, the field updates perfectly with the data being cleared (even though there is no post data for that field-id combination)

I couldn't get my head around how this is done in the sql_update_grid function so that I could suggest an update accordingly for the sql_update function.

Can you help?

Image upload_path possible issue

Hi !
I have been trying to use the image type in a form, so that the user can upload an image to the record.

Although i have set up the upload_path variable to my relative image path, i keep getting the error that the path either does not exist or it is not writable.

"Error: Error: Unable to move uploaded file. Make sure path: /tf_images/tf_contact_images exists and is writeable. Try chmod 0755 (or 0777 is you must) on the destination path.

Sent From: get_upload()"

Of course the path exists and it is writable.

I tried to use a full path and, although it shouldn't have, it worked.
The images were uploaded and the thumbnails were created at the right places.
But then the images could not be displayed as the path is obviously wrong, since a relative path is required.

After i changed the path back to the relative form, the images were displayed correctly.

They were also displayed correctly using the relative path and writing the name of the image file directly to the database.

So i think there maybe is an issue here with the form of the path while uploading and displaying an image.

Or hopefully i am missing something ?

Best Regards

Issue with get_columns(...)

The following query will have error

SELECT
    j.LogId,j.Id,GROUP_CONCAT(L.Code ORDER BY FIND_IN_SET(L.Id, j.Locations))
FROM
    job_log j
LEFT JOIN
    location L ON FIND_IN_SET(L.Id, j.Locations) != 0 
WHERE
    j.Id = 3

The ORDER BY onwards will be replaced in get_columns() function with blank, so the query is truncated, and there will be error.

from get_columns(...) ...

        // simplify query for faster execution
        $sql = rtrim($sql, "\r\n\t; ");                         // remove last semicolon
        $sql = preg_replace('/order\s+by\s+.+$/i', '', $sql);   // remove order
        $sql = preg_replace('/limit\s+[0-9,\s]+$/i', '', $sql); // remove limit
        $sql .= ' limit 0 ';                                    // add limit

Is it possible not to have the remove order?

Dependency for --select

Hi ,

I have car make and model two different List fields.
Make is selected from the query from the table using "--select "

But for the model, I need to provide dynamic make which is just selected from the previous field, cause it needs to show only the model belong the car make.

How this can be achieved in Lazy mofo.

In simple How to pass previous field value to select statement for --select?

Thanks very much.

How to Suppress Adding Records

Even if we make $lm->grid_add_link = '';, the Add/Edit Link like http://localhost/lm/myapp.php?action=edit& can be used to inject records.

There should be a way to completely disable Add / Edit / Delete by making the appropriate actions disabled in the run() method.

bug in new code for custom functions

the 2019-01-10 update in code which "Changed syntax for input/output controls and validation, backward compatible."

has an error for user defined functions. the complete $command is no longer passed to the function, but the $type is passed instead of $command

Upon looking at the class the following changes need to be made:
in the get_input_control function
change:
elseif(is_callable($type))
return call_user_func($type, $column_name, $value, $type, $called_from, $validate_placeholder) . $validate_tip . $validate_error_msg;

to:
elseif(is_callable($type))
return call_user_func($type, $column_name, $value, $control, $called_from, $validate_placeholder) . $validate_tip . $validate_error_msg;

and similarly in the get_output_control function
change:
elseif(is_callable($type))
return call_user_func($type, $column_name, $value, $type, $called_from);

to:
elseif(is_callable($type))
return call_user_func($type, $column_name, $value, $control, $called_from);

without this fix, the user defined functions are not backward compatible either.

Thanks for a great class. I am coming up with lots of functions that may help others. don't know where to post them though. Or shall I email them?

$upload_path and external links

There is a tiny issue with this declaration and its explanation in line 71 of lazy_mofo.php library:
`public $upload_path = 'uploads'; // required when using --image or --document input types

The thing is that this variable is used not only in input types, but in output too.
For example:

   function html_document_output($file_name){
        // purpose: if exists, display document link
        // returns: html

        if(mb_strlen($file_name) > 0)
            $html = "<a href='$this->upload_path/$file_name' target='_blank'>" . $this->clean_out($file_name, $this->grid_ellipse_at) . "</a>";

        return $html;

    }

Now let’s assume that I need to setup an external link on my grid.

It is currently impossible to setup external link, because all the links will look like http://myLazyMofosite/upload/http://external.site.com (in default setup)
or http://myLazyMofosite/http://external.site.com if we clear $upload_path variable.

Do not know if this is intended behavior, but for my purposes I have to modify the function:

    function html_document_output($file_name){

        // purpose: if exists, display document link
        // returns: html

        if(mb_strlen($file_name) > 0)
            $html = "<a href='$file_name' target='_blank'>" . $this->clean_out($file_name, $this->grid_ellipse_at) . "</a>";

        return $html;

    }

Now my external links are made up correctly.

Change language

Hi,

I have a mistake charging translation file i18n :

In the connect file on root folder :
$lm_data = new lazy_mofo ($dbh, 'fr-fr');

I have to change line 188 to make it run :
if(!file_exists("vendor/datagrid/i18n/{$i18n}.php"))

Otherwise, there is an error "file not found".

Did I miss something ?

compulsory order by

I think it should be mentioned in the documentation somewhere that if order by is used within any internal select or group_concat in the grid query, then lazymofo detects that as the last 'order by' and breaks the query, so need to compulsorily add an order by to the entire query, at least something like order by 1

html_select function performance improvement suggestion

I noticed that in the html_select function, the line:
'$result = $this->query($sql, $sql_param, 'html_select()');'
implies that query for the options is being processed everytime the function is called.

This means that if select or selectmultiple is used in a 'grid_input_control' function in a grid with the default 200 records, the exact same query is processed 200 times. Although, these queries run in milliseconds, that is still an unnecessary overhead that builds up in grid views.

My suggestion:
summary: save the result into a php variable and call that variable every time.
detail:

  1. generic name for this variable, I would propose
    $this->['sqlresults'][$field_name][$_POST['_called_from']]
    this ensures that it is is bound to the column name as well as grid/form view so that if the user uses a different query grid_input_control and form_input_control, there is no clash

  2. see if this element in array is set, if not run query and save into it:

if(isset($this->['sqlresults'][$field_name][$_POST['_called_from']]){
   $result = $this->['sqlresults'][$field_name][$_POST['_called_from']];
} else {
  $result = $this->['sqlresults'][$field_name][$_POST['_called_from']] = $this->query($sql, $sql_param, 'html_select()');
}
  1. if worried about freeing up php memory, at the end of the class, the whole $this->['sqlresults'] can be unset in one go.

Right Aligning Numeric field values

The new output function can be used:

    function number_out($str){

        // purpose: convert text format to right aligned number

        $str += 0;
        
        return '<p style="text-align:right">'.$str.'</p>';

    }

Also modify the function get_output_control() to be:

    function get_output_control($column_name, $value, $command, $called_from){

        // purpose: render html output based "command", if command is then try to call a user function
        // returns: html 

        // get command only, no '--'
        $cmd = trim(mb_substr($command, mb_strrpos($command, '--') + 2));

        // default
        if(mb_strlen($cmd) == 0)
            $cmd = 'text';

        if($cmd == 'text')
            return $this->clean_out($value, $this->grid_ellipse_at); 
        elseif($cmd == 'date')
            return $this->date_out($value); 
        elseif($cmd == 'datetime')
            return $this->date_out($value, true); 
        elseif($cmd == 'number')
            return $this->number_out($value); 
        elseif($cmd == 'email')
            return "<a href='mailto:$value'>$value</a>";
        elseif($cmd == 'document')
            return $this->html_document_output($value);
        elseif($cmd == 'image')
            return $this->html_image_output($value);
        elseif($cmd == 'html')
            return $this->html_html_output($value);
		elseif(is_callable($cmd))
            return call_user_func($cmd, $column_name, $value, $command, $called_from);
        else
            $this->display_error("Output command or user function not found: $cmd. Be sure to prefix control type with 2 dashes --", 'get_output_control()');

    }

And use it like:

$lm->grid_output_control['ID'] = '--number';

Full File Path is Not Returned with --document Feature in Add or Update Grids

I defined a field using a '--document' type and only the filename is returned. In order to upload the file to a MySQL blob type field (during on_insert or on_update user function), I need the entire file path and file name from the client PC but the file path is not returned.

BTW, have you ever considered adding the ability to upload a file to a SQL blob field? This would not necessitate my having to define a function to do this in an on_insert or on_update user function. Just a thought.

Inline Editing demo

In your documentation you said this Class support inline editing..
can you give some demo or snippet how to use it ? I can't find code/function for inline editing in your class

$uri_path property for search function

Hi,
I using experimental $uri_path property =) and looks nice when I using include pages for functions add, edit, delete.. But when I want to use function search so I lost my variables from URI.

What I see, uri_path is also use for search button, but when is used variables are lost.
Some ideas?

Thanks
Z

Pagination ?

I played around with and forked this project. Has anyone tried to add pagination to the project? When I connected my data ( ~2000 records) , it just scrolled forever.

No results leads to broken layout

Div is missing.

 if($count <= 0){
            $html .= "<div class='lm_error'><b>$this->grid_text_no_records_found</b></div></form>

should be
<div class='lm_error'><b>$this->grid_text_no_records_found</b></div></form></DIV>

Validation Tips

Do you have an example of validation tip popups e.g "Required Field" to be generated instead of errors screens?

Current date / time auto population and csv import

Hi, first, thank you for the great and clean code!
More as an example request, could you please recommend what is the best way to populate now() value in date datetime types as a default or so?
Also for testing (again as sample, not the class), it may be valuable to be able to re import the CSV file back to database,
Any advice will be appreciated.

Path ?

Hi
How to include path to lazy_mofo.php folder ?
in my project, It's located in "vendor/datagrid" and CSS isn't call.
Thanks

text input for paging in giant datasets at the bottom of page doesn't work

While translating your code I recognized the text input fields for paging in giant datasets and tested it. The one on the top of the page is working correct. If I try to enter a page number in the form at the bottom and press the go button it picks the value from the text input field at the top of the page.

Integrating with User Frosting

Hi,

This is fantastic code... very easy to use for any enterprise application.

I have a small issue, I use UserFrosting (https://github.com/alexweissman/UserFrosting) for managing users/profile/authorization etc.

I have created new php and integrated your demo.php.

It works brilliantly ... saves all the information.

Only issue is after Save... Screen go Blank... it doesn't show "Record saved" at the top.

Please help me to find where is the issue is?

Code Starts here

<title>Consumer Feeder Mapping</title> echo renderAccountPageHeader(array(
"#SITE_ROOT#" => SITE_ROOT,
"#SITE_TITLE#" => SITE_TITLE,
"#PAGE_TITLE#" => "Dashboard"
));

?>

<div id="wrapper">

  <!-- Sidebar -->
    <?php

echo renderMenu("consumer_feeder_map");
?>

<div id="page-wrapper">
    <div class="row">
      <div id='display-alerts' class="col-lg-12">

      </div>
  </div>
"; // connect with pdo try { $dbh = new PDO("mysql:host=$db_host;dbname=$db_name;", $db_user, $db_pass); } catch(PDOException $e) { die('pdo connection error: ' . $e->getMessage()); } // create LM object, pass in PDO connection $lm = new lazy_mofo($dbh); // table name for updates, inserts and deletes $lm->table = 'market'; // identity / primary key for table $lm->identity_name = 'market_id'; // optional, make friendly names for fields $lm->rename['country_id'] = 'Country'; // optional, define input controls on the form $lm->form_input_control['photo'] = '--image'; $lm->form_input_control['is_active'] = "select 1, 'Yes' union select 0, 'No' union select 2, 'Maybe'; --radio"; $lm->form_input_control['country_id'] = 'select country_id, country_name from country; --select'; // optional, define editable input controls on the grid $lm->grid_input_control['is_active'] = '--checkbox'; // optional, define output control on the grid $lm->grid_output_control['contact_email'] = '--email'; // make email clickable $lm->grid_output_control['photo'] = '--image'; // image clickable // new in version >= 2015-02-27 all searches have to be done manually $lm->grid_show_search_box = true; // optional, query for grid(). LAST COLUMN MUST BE THE IDENTITY for [edit] and [delete] links to appear $lm->grid_sql = " select m.market_id , m.market_name , m.photo , m.contact_email , c.country_name , m.is_active , m.create_date , m.market_id from market m left join country c on m.country_id = c.country_id where coalesce(m.market_name, '') like :_search or coalesce(m.contact_email, '') like :_search or coalesce(c.country_name, '') like :_search order by m.market_id desc "; $lm->grid_sql_param[':_search'] = '%' . trim(@$_REQUEST['_search']) . '%'; // optional, define what is displayed on edit form. identity id must be passed in also. $lm->form_sql = " select market_id , market_name , country_id , photo , contact_email , is_active , create_date , notes from market where market_id = :market_id "; $lm->form_sql_param[":$lm->identity_name"] = @$_REQUEST[$lm->identity_name]; // optional, validation. input: regular expression (with slashes), error message, tip/placeholder // first element can also be a user function or 'email' $lm->on_insert_validate['market_name'] = array('/.+/', 'Missing Market Name', 'this is required'); $lm->on_insert_validate['contact_email'] = array('email', 'Invalid Email', 'this is optional', true); // copy validation rules to update - same rules $lm->on_update_validate = $lm->on_insert_validate; // use the lm controller $lm->run(); echo ""; ?>

--- Code ends

New localization file for Greek Language el-gr.php

Dear iansoko

I created a localization file for the Greek language, el-gr.php, (tested it and seem to work ok), for the i18n folder and i do not know how to send it to you.

I am not an experienced github user so i am not sure if i should try something through the github repository or just email it to you.

Validation Popups/Tooltips

Do you have an example of validation tip popups e.g "Required Field" to be generated instead of errors screens?

Adding/Editing Error: Checkboxes are returned unchecked if error occurs in another field

I have two form input checkbox controls defined as:

$lm->form_input_control['event_sd_dance_program'] = "select 'Student Level-MS', 'Student Level-Mainstream' union select 'MS', 'Mainstream' union select 'PL', 'Plus' union select 'A1', 'Advanced 1' union select 'A2', 'Advanced 2' union
select 'C1', 'Challenge 1' union select 'C2', 'Challenge 2' union select 'C3', 'Challenge 3' union select 'C4', 'Challenge 4' union select 'C5', 'Challenge 5' union select 'RD', 'Rounds'; --checkbox";

$lm->form_input_control['event_rd_dance_program'] = "select 'I', 'Phase 1' union select 'II', 'Phase 2' union select 'III', 'Phase 3' union select 'IV', 'Phase 4' union
select 'V', 'Phase 5' union select 'VI', 'Phase 6'; --checkbox";

If I raise an error with any on_insert_validate field in either an Add form or an Edit form, such as:

$lm->on_insert_validate['event_date'] = array('/.+/', 'Missing Event Date', 'Required Field');

then the any selected checkboxes are cleared (returned unchecked).

Am I missing something or is this a bug?

Warning: Cannot modify header information - headers already sent by

I am getting this error on "INSERT"

Warning: Cannot modify header information - headers already sent by (output started at C:\Users\ps\Desktop\taxi\application\cars.php:20) in C:\Users\ps\Desktop\taxi\application\lazy_mofo.php on line 2313

It is because i am sending the styling information and ... on line 20, so the redirect cannot work.

I am sure i am missing something because this procedure should be done at each insert.

I am using php in cgi mode

Identity

Hi,

I use this statement to spcify id colum:
$lm_data->identity_name = 'id_droit';
The grid is well printed but when I click on add button, I get Edit form with this error :
Missing identity_id. If using a custom form_sql statement be sure to include the identity.
However I don't use form_sql.

Thanks

Formatting Fields

Is there any way to format a field that is being displayed? For example, I would like to change the output text to a different text size and bold the font.

special chars in query string - preg_match_all with PREG_OFFSET_CAPTURE and UTF-8

If I use any special characters like German Umlauts (äöü) in a sql query I get an error because lazy_mofo removes order by in the wrong place. It took me a while to find the issue. PREG_OFFSET_CAPTURE doesn't care about special chars.

My temporary workaround:

I added a new function mb_preg_match_all to lm (copy-paste from here) and changed preg_match_all on lines 844 and 1690 to $this->mb_preg_match_all.

Before I forget about it - thanks for this great piece of code. I try to write a small application with it and your datagrid saved me a lot of time.

Issue with search.

Hi, I'm just new here and I like your work, Lazymofo really makes things easy in CRUD.
I have been exploring 'uri path' and its working perfectly in adding & updating data but I noticed in searching it seems to fail.

Here's what I did:
// uri path
$lm->uri_path = "admin.php?tab=2";

When I update data, the url is working properly:
localhost/administrator/admin.php?tab=2&action=edit&id=1829&

But when I do a search, tab=2 is gone.
localhost/administrator/admin.php?_search=cruz&action=search

I wonder if I'm doing things right. Hope you can help me with this. Thank you.

Master Detail

At first many thank for this fantastic class.
My question:
Is there a way to create Master/Detail forms?
e.g. an invoice has a invoice header and n invoice lines

KR
Axel

Can i ignore a text input field on record save/new ?

Hallo Ian.

I have a question about how i can achieve a certain functionality i want.

The sort version of my question is this:

Can i have an input field, which does not belong to the lm source table, in a lm grid that will not be included in the sql when the changes are saved ?

Now i know that is not very explanatory so here goes the long version of my question :

Basic Example:

I have a main table

"contacts_table"

This table has an id field and a contact name field e.g.

"contacts_table.contact_id"
"contacts_table.contact_name"

I also have a table with tasks

"tasks_table"

that table has a contact_id field so that a task can be assigned to a contact, and of course a task field.

"tasks_table.task_id"
"tasks_table.task_name"
"tasks_table.contact_id"

I produce a view with the two tables linked on the common contact_id field and the new tasks view looks like

"tasks_view.task_id"
"tasks_view.task_name"
"tasks_view.contact_id"
"contacts_table.contact_name"

Now, because the user must be able to change the contact assigned to the task, i have setup a lm datagrid with all the fields of the "tasks_view".
The source table, (for updates/deletes etc.) of the lm is of course the "tasks_table".

The "contact_id" field is a text input field, but naturally the user is not supposed to know the contact id.
So, the "contact_name" field is a text input field with jquery ui autocomplete, so that the user can change the contact easily by autocompleting the contact name.
As soon as the contact name is changed, the contact_id field is also updated with the new contact id with the use of javascript.

All the above is happening on the grid, not on the form.

My problem is that if i try to save the change, it returns an error because, obviously, the "contact_name" field does not belong to the "tasks_table".

Is there a way that i can save the change but not include the contact_name field in the sql ?

I tried the exclude_field method but the results are the same.

Thanks in advance.

PHP Notice error

Undefined variable: port in lazy_mofo.php on line 2263
Undefined variable: context in lazy_mofo.php on line 555
Undefined index: HTTPS in lazy_mofo.php on line 2256
Undefined variable: port in lazy_mofo.php on line 2263

these do nto appear to be affecting functionality, just annoying.
I can remove the errors by declaring variable with empty or null values, but having difficulty working out what may fail by doing so.

Mike B

French language

Hi,
Writing 'fr-fr' instead of 'en-us' retrune 'fr-fr' not found.
I have tried to change path to folder location /vendor/datagrid but it doesn't work.
Thanks

Make Styling functions

Hello :)

it would be a good thing if we had a generate_html function or functions dedicated to creating all html parts.

This would allow everybody to take the class, overwrite the html functions and adapt it for Bootstrap 3 for ex. and still keep the base code.

Redirection to specific div in webpage

Dear iansoko

I wanted to ask regarding redirecting after a grid is updated or a new record is added/edited etc.

Since i load my LMDatagrid in a specific div of my page without reloading the page, (using js and ajax), i want the edit forms or the updated grid to appear in the original div that the LMdatagrid was loaded.

I noticed that you do have a feature "$redirect_using_js" but i cannot find an example of its use in your documentation.

Can you direct me somewhere ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.