Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- var $dgLocal = $('#data-grid-local')
- ,$pesqcidade = $("#pesqcidade")
- ,$pesquf = $("#pesquf");
- $dgLocal.datagrid({
- autoLoad: false
- ,pagination: false
- ,rowNumber: true
- ,jsonStore: {
- url: 'Dados/cidade_json.php'
- }
- ,ajaxMethod: 'post'
- ,mapper:[{
- name: 'cidade',title:'Cidade',width:200,align:'center'
- },{
- name: 'uf',title:'UF',width:50,align:'left'
- }]
- ,eventController: {
- onClickRow: function(tr) {
- document.getElementById('cidade').value = tr.cells[1].innerHTML;
- document.getElementById('uf').value = tr.cells[2].innerHTML;
- }
- }
- });
- $('#btnpesquisa').on('click',function (){
- if( $pesqcidade.val() !== "" ){
- $dgLocal
- .datagrid('addParam',{
- cidade: $pesqcidade.val()
- ,uf: $pesquf.val()
- })
- .datagrid('load');
- }else{
- Alert('Digite uma cidade para pesquisar.');
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement