Jump to content


focus first field on add action... (datatables theme)

datatables focus

  • Please log in to reply
2 replies to this topic

#1 Charles A.

Charles A.

    Member

  • Members
  • PipPip
  • 17 posts

Posted 23 June 2013 - 03:08 AM

Hi,

how can I set focus on the first element of the form when adding a new record? (in datatables theme).

Thanks!

 

 



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 23 June 2013 - 05:01 AM

For this you will need to use jQuery and go under assets/grocery_crud/themes/datatables/js open datatables.js and there add the proper jquery code.

Somewhere under line 16 on the $(document).ready(function() {

and type... https://www.google.g...chrome&ie=UTF-8


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 Charles A.

Charles A.

    Member

  • Members
  • PipPip
  • 17 posts

Posted 23 June 2013 - 07:26 PM

Thanks for your answer! What I really did was to edit under 
 assets/grocery_crud/themes/datatables/js

 

the files

datatables-edit.js

datatables-add.js

 

and add this line somewhere after "$(function(){".... 

$("#crudForm input:text").first().focus();

Works perfect ;)







Also tagged with one or more of these keywords: datatables, focus

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users